結果

問題 No.1131 Deviation Score
ユーザー kikage
提出日時 2020-10-06 16:38:04
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 341 bytes
コンパイル時間 470 ms
コンパイル使用メモリ 31,616 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 03:52:35
合計ジャッジ時間 1,382 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%d",&N);
      |     ~~~~~^~~~~~~~~
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%lf",&x[i]);
      |         ~~~~~^~~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <cmath>
int main(){
    int N;
    double x[100000],sum=0;
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        scanf("%lf",&x[i]);
        sum+=x[i];
    }
    double ave=sum/N;
    for(int i=0;i<N;i++){
        int d=floor(50.0-(ave-x[i])/2.0);
        printf("%d\n",d);
        sum+=x[i];
    }
    return 0;
}
0