結果
| 問題 | 
                            No.476 正しくない平均
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2018-03-19 18:20:26 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1 ms / 2,000 ms | 
| コード長 | 322 bytes | 
| コンパイル時間 | 288 ms | 
| コンパイル使用メモリ | 27,008 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2025-01-02 21:12:23 | 
| 合計ジャッジ時間 | 1,657 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 26 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%ld %ld",&n,&a);
      |     ~~~~~^~~~~~~~~~~~~~~~~
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%ld",&x);
      |         ~~~~~^~~~~~~~~~
            
            ソースコード
#include <stdio.h>
int main(){
    //input
    long n,a;
    scanf("%ld %ld",&n,&a);
    long total = 0;
    for (int i = 0;i < n;i++){
        long x;
        scanf("%ld",&x);
        total += x;
    }
    //output
    if (total == a*n){
        printf("YES\n");
    }else{
        printf("NO\n");
    }
    return 0;
}