結果
| 問題 |
No.476 正しくない平均
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-03-19 18:17:53 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 316 bytes |
| コンパイル時間 | 318 ms |
| コンパイル使用メモリ | 27,008 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2025-01-02 21:01:02 |
| 合計ジャッジ時間 | 1,157 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 WA * 1 |
コンパイルメッセージ
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("%d %d",&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("%d",&x);
| ~~~~~^~~~~~~~~
ソースコード
#include <stdio.h>
int main(){
//input
int n,a;
scanf("%d %d",&n,&a);
int total = 0;
for (int i = 0;i < n;i++){
int x;
scanf("%d",&x);
total += x;
}
//output
if (total == a*n){
printf("YES\n");
}else{
printf("NO\n");
}
return 0;
}