結果
| 問題 |
No.476 正しくない平均
|
| ユーザー |
cowgirl
|
| 提出日時 | 2018-09-16 13:01:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 273 bytes |
| コンパイル時間 | 1,471 ms |
| コンパイル使用メモリ | 166,916 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 07:22:22 |
| 合計ジャッジ時間 | 2,217 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 15 WA * 11 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:11:17: warning: 'sum' may be used uninitialized [-Wmaybe-uninitialized]
11 | if(a == sum / n) cout << "YES" << endl;
| ~~~~^~~
main.cpp:6:9: note: 'sum' was declared here
6 | int sum;
| ^~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a; cin >> n >> a;
int x[10];
int sum;
for(int i=0; i < n; i++){
cin >> x[i];
sum += x[i];
}
if(a == sum / n) cout << "YES" << endl;
else cout << "NO" << endl;
}
cowgirl