結果

問題 No.79 過小評価ダメ・ゼッタイ
コンテスト
ユーザー tntan
提出日時 2015-12-14 20:19:04
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 363 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 379 ms
コンパイル使用メモリ 85,556 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-03-12 23:43:19
合計ジャッジ時間 1,229 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:26:17: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
   26 |         cout << ans << endl;
      |                 ^~~
main.cpp:17:23: note: 'ans' was declared here
   17 |         int MAX = -1, ans;
      |                       ^~~

ソースコード

diff #
raw source code

#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include <vector>
using namespace std;

int main()
{
	int n, a, t[7] = {};
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a;
		t[a]++;
	}
	int MAX = -1, ans;
	for (int i = 1; i <= 6; i++)
	{
		if (MAX <= t[i])
		{
			ans = i;
			MAX = t[i];
		}
	}
	cout << ans << endl;
	return 0;
}
0