結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー N/A
提出日時 2018-08-24 06:49:14
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 329 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 25,216 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2025-01-02 16:31:19
合計ジャッジ時間 1,297 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 20 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%d", &freq);
      |         ^~~~~~~~~~~~~~~~~~
main.c:10:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |                 scanf("%d", &resp);
      |                 ^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void) {
	int freq, resp, maj = 0;
	int lv[6] = { 0 };

	scanf("%d", &freq);
	for (int i = 0; i < freq; i++) {
		scanf("%d", &resp);
		lv[resp - 1]++;
	}

	for (int j = 0; j < 6; j++) {
		if (lv[maj - 1] <= lv[j])
			maj = j + 1;
	}
	printf("%d\n", maj);
	
	return 0;
}
0