結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー sasa
提出日時 2025-03-05 14:13:55
言語 C
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 510 bytes
コンパイル時間 681 ms
コンパイル使用メモリ 25,472 KB
実行使用メモリ 10,020 KB
最終ジャッジ日時 2025-03-05 14:14:08
合計ジャッジ時間 13,292 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other TLE * 1 -- * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%d",&num);
      |         ^~~~~~~~~~~~~~~~
main.c:14:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |                 scanf("%d",&p[i]);
      |                 ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	// 同意見の集計
	int agg[7];
	int *aggp = agg;
	// アンケート数
	int num = 0;
	scanf("%d",&num);
	// アンケート結果
	int survey[num + 1];
	int *p = survey;
	for(int i = 0;i < num;i++){
		scanf("%d",&p[i]);
		// 同意見をまとめる
		for(int j = 0;j < 6;i++){
			if(j + 1 == p[i]){
				aggp[j] += 1;
			}
		}
	}
	// 最も多い意見を探す
	int ans = 0;
	for(int i = 0;i < 6;i++){
		if(aggp[i] >= ans){
			ans = i + 1;
		}
	}
	printf("%d",ans);
	
	
}
0