結果
| 問題 |
No.476 正しくない平均
|
| コンテスト | |
| ユーザー |
Haijinn
|
| 提出日時 | 2017-01-29 15:16:06 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 300 bytes |
| コンパイル時間 | 261 ms |
| コンパイル使用メモリ | 22,400 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-23 23:09:57 |
| 合計ジャッジ時間 | 1,161 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 26 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:12:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%d%lld",&n,&a);
| ^~~~~~~~~~~~~~~~~~~~~
main.c:14:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%lld",&x[i]);
| ^~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(void)
{
int n;
long long x[10];
long long a;
int i;
long double s=0;
double as;
scanf("%d%lld",&n,&a);
for(i=0;i<n;i++){
scanf("%lld",&x[i]);
}
for(i=0;i<n;i++){
s+=x[i];
}
as=s/n;
printf("%f\n",as);
if(as==a){
puts("YES\n");
}else{
puts("NO\n");
}
return 0;
}
Haijinn