結果
| 問題 |
No.476 正しくない平均
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-03-19 18:15:13 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 324 bytes |
| コンパイル時間 | 377 ms |
| コンパイル使用メモリ | 27,520 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2025-01-02 20:46:01 |
| 合計ジャッジ時間 | 1,254 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 WA * 7 |
コンパイルメッセージ
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 (double(total)/n == a){
printf("YES\n");
}else{
printf("NO\n");
}
return 0;
}