結果
| 問題 |
No.476 正しくない平均
|
| ユーザー |
Elk
|
| 提出日時 | 2018-05-30 23:27:50 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 396 bytes |
| コンパイル時間 | 105 ms |
| コンパイル使用メモリ | 22,528 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-30 08:26:30 |
| 合計ジャッジ時間 | 942 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 17 WA * 9 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%lld %lld\n", &N, &a);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%lld", &num[i]);
| ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(){
long long int N, a, i;
long long int num[10], ave = 0;
scanf("%lld %lld\n", &N, &a);
for(i = 0; i < N; i++){
scanf("%lld", &num[i]);
ave += num[i];
}
ave /= N;
//printf("a = %lld ave = %lld\n", a, ave);
if(a == ave && ave%N == 0){
printf("YES\n");
}else{
printf("NO\n");
}
return 0;
}
Elk