結果

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

ソースコード

diff #

#include <stdio.h>

int max(int arg[], int n) {
	int m = arg[n - 1], s = n, i;
	for (i = n - 2; i >= 0; i--) {
		if (m < arg[i]) {
			m = arg[i];
			s = i + 1;
		}
	}
	return s;
}

int main() {
	int n, l[100000], c[6] = {}, i;

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

	printf("%d\n", max(c, 6));

	return 0;
}
0