結果

問題 No.476 正しくない平均
ユーザー くれちー
提出日時 2017-01-27 22:27:23
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 307 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 20,352 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 16:08:44
合計ジャッジ時間 1,133 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 20 WA * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%lld %lld", &n, &a);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%lld", &x);
      |         ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#define rep(i, n) for (i = 0; i < n; i++)

int main() {
    long long n, a;
    scanf("%lld %lld", &n, &a);
    long long i, x, s = 0;
    rep(i, n) {
        scanf("%lld", &x);
        s += x;
    }

    if ((double)(s / n) == (double)a) puts("YES");
    else puts("NO");
    return 0;
}
0