結果

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

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(){
	int n;
	int i;
	int l[100000];
	int a[6];
	int x=0;
	int j;
	int temp=0;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		
		scanf("%d",&l[i]);
		
		
	}

	temp=1;
	for(i=0;i<6;i++){
		a[i]=0;
		for(j=0;j<n;j++){
			if(l[j]==i+1){
				
				
				a[i]++;
				
				
				
			}

		}
		
		if(a[temp-1]<a[i]){
			temp=i+1;
		}
		if(a[temp-1]==a[i]){
			
			temp=i+1;
			
			
			
			
		}
		
		
		
		
		
		
		}
	
	printf("%d\n",temp);
	
	return 0;
	
}
0