結果
| 問題 |
No.476 正しくない平均
|
| コンテスト | |
| ユーザー |
Maeda
|
| 提出日時 | 2025-03-10 11:19:16 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 327 bytes |
| コンパイル時間 | 470 ms |
| コンパイル使用メモリ | 25,088 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-10 11:19:18 |
| 合計ジャッジ時間 | 1,773 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d",&n);
| ^~~~~~~~~~~~~~
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%le",&a);
| ^~~~~~~~~~~~~~~
main.c:14:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%d",&num);
| ^~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
void main(void){
int n = 0 ;
double a = 0;
//数字の数
scanf("%d",&n);
//maiさんが手計算で平均を求めた結果
scanf("%le",&a);
int num = 0 ;
double sum = 0;
for(int i = 0;i< n;i++){
scanf("%d",&num);
sum += num;
}
if(sum/n == a){
printf("YES");
}else{
printf("NO");
}
}
Maeda