結果

問題 No.476 正しくない平均
ユーザー Haijinn
提出日時 2017-01-29 14:25:40
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 303 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 21,248 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 23:09:55
合計ジャッジ時間 1,036 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:15:17: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘long long int *’ [-Wformat=]
   15 |         scanf("%d",&x[i]);
      |                ~^  ~~~~~
      |                 |  |
      |                 |  long long int *
      |                 int *
      |                %lld
main.c:11:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 | scanf("%lld%lld",&n,&a);
      | ^~~~~~~~~~~~~~~~~~~~~~~
main.c:15:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |         scanf("%d",&x[i]);
      |         ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void)
{
 long long n;
 long long a;
 long long x[10];
int i;
int d=0;
double k;
scanf("%lld%lld",&n,&a);
for(i=0;i<n;i++){
	
	
	scanf("%d",&x[i]);
	
	d+=x[i];
}
k=(double)d/n;

//printf("%f",k);
if(k==a){
	printf("YES\n");
	
	
	
	
}else{
	
	printf("NO\n");
}



	return 0;
}
0