結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー daradara_sanma
提出日時 2017-07-02 14:14:33
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 17 ms / 5,000 ms
コード長 386 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 54,520 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-26 08:14:40
合計ジャッジ時間 1,400 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<array>
using namespace std;

int main() {
	int n, l[7] = {};
	cin >> n;

	for (int i = 1; i <= n; i++)
	{
		int temp;
		cin >> temp;
		l[temp]++;
	}
	
	int ans = 0;
	for (int i = 1; i < 7; i++)
	{
		if (l[ans] < l[i])
		{
			ans = i;
		}
		else if (l[ans] == l[i])
		{
			ans = (ans > i) ? ans : i;
		}
	}
	cout << ans << endl;

	return 0;
}
0