#40717: 超快超小


seancai78@gmail.com (風月春秋)

學校 : 臺北市立成功高級中學
編號 : 176406
來源 : [140.113.124.211]
最後登入時間 :
2025-05-19 14:33:05

不要陣列
輸入比x大加count_r
反之加count_l

隨時記錄最大/最小位置

最後比較count_l和count_r
決定採用最大或最小位置

scanf("%d",&input);
        if(input>x)
        {
            count_r++;
            if(max < input)
                max = input;
        }
        else
        {
            count_l++;
            if(min > input)
                min = input;
        }

 

#40718: Re: 超快超小


seancai78@gmail.com (風月春秋)

學校 : 臺北市立成功高級中學
編號 : 176406
來源 : [140.113.124.211]
最後登入時間 :
2025-05-19 14:33:05

不要陣列
輸入比x大加count_r
反之加count_l

隨時記錄最大/最小位置

最後比較count_l和count_r
決定採用最大或最小位置

scanf("%d",&input);
        if(input>x)
        {
            count_r++;
            if(max < input)
                max = input;
        }
        else
        {
            count_l++;
            if(min > input)
                min = input;
        }

 


等等,怎麼那麼多
失誤失誤
太急了多點幾下