結果

問題 No.476 正しくない平均
ユーザー a2011404
提出日時 2017-03-10 14:43:57
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 224 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 21,376 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-24 07:47:36
合計ジャッジ時間 1,164 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 15 WA * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:20: warning: format ‘%d’ expects argument of type ‘int *’, but argument 3 has type ‘double *’ [-Wformat=]
    8 |         scanf("%d %d",&n,&a);
      |                   ~^     ~~
      |                    |     |
      |                    int * double *
      |                   %le
main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%d %d",&n,&a);
      |         ^~~~~~~~~~~~~~~~~~~~
main.c:11:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |                 scanf("%d",&x[i]);
      |                 ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void){

	int n,x[10],i,A=0;
	double a;

	scanf("%d %d",&n,&a);

	for(i=0;i<n;i++){
		scanf("%d",&x[i]);
		A=A+x[i];
	}	

	if(a == (double)(A/n))	printf("YES");
	else		printf("NO");

	return 0;
}
0