結果
問題 |
No.476 正しくない平均
|
ユーザー |
![]() |
提出日時 | 2017-03-10 21:47:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 456 bytes |
コンパイル時間 | 443 ms |
コンパイル使用メモリ | 58,136 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 07:56:16 |
合計ジャッジ時間 | 1,340 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:24:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 24 | scanf("%lld", &num); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <iostream> #include <cstdio> #include <algorithm> #include <cstdlib> #include <cstring> using namespace std; #define FOR(i,a,b) for (int i = (a); i < (b); i++) #define REP(i,n) FOR(i,0,n) typedef long long ll; int main(){ int n, a; cin >> n >> a; ll sum = 0; REP(i,n){ ll num; scanf("%lld", &num); sum += num; } if ((double)sum/(double)n == (double)a) cout << "YES" << endl; else cout << "NO" << endl; return 0; }