結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー a2011404
提出日時 2017-03-17 10:20:40
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 10 ms / 5,000 ms
コード長 430 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 21,504 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-26 08:10:23
合計ジャッジ時間 1,035 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
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:10:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |                 scanf("%d",&l[i]);
      |                 ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>


int main(void){
	int 	i,n,l[100000]={0},a[7]={0},max=0,num=0;

	scanf("%d",&n);

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

	for(i=0;i<n;i++){
		switch(l[i]){
			case 1:a[1]++;break;
			case 2:a[2]++;break;
			case 3:a[3]++;break;
			case 4:a[4]++;break;
			case 5:a[5]++;break;
			case 6:a[6]++;break;
		}
	}

	for(i=1;i<7;i++){
		if(max<=a[i]){
			max=a[i];
			num=i;
		}
	}
	printf("%d",num);
	return 0;
}
0