結果
| 問題 |
No.476 正しくない平均
|
| コンテスト | |
| ユーザー |
daradara_sanma
|
| 提出日時 | 2018-04-30 14:28:52 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 332 bytes |
| コンパイル時間 | 417 ms |
| コンパイル使用メモリ | 59,124 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-27 23:54:17 |
| 合計ジャッジ時間 | 1,318 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 9 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%d %d", &n, &a);
| ~~~~~^~~~~~~~~~~~~~~~~
main.cpp:15:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
15 | scanf("%d", &xi);
| ~~~~~^~~~~~~~~~~
ソースコード
#include <iostream>
#include <string>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
int main() {
int n, a, xi;
float ans = 0;
scanf("%d %d", &n, &a);
for (int i = 0; i < n; i++)
{
scanf("%d", &xi);
ans += xi;
}
if (float(a) == ans / n) printf("YES\n");
else printf("NO\n");
return 0;
}
daradara_sanma