結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー shiratama
提出日時 2016-08-14 08:32:32
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 285 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 53,848 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-07 16:40:25
合計ジャッジ時間 1,866 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 20 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:22: warning: ‘max_i’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   20 |         std::cout << max_i << std::endl;
      |                      ^~~~~

ソースコード

diff #

#include <iostream>

auto main() -> int {
	int N;
	std::cin >> N;

	int L;
	int max = 0;
	int max_i;
	int scores[7];
	for (int i = 0; i < N; ++i) {
		std::cin >> L;
		scores[L]++;
		if (scores[L] > max) {
			max   = scores[L];
			max_i = L;
		}
	}

	std::cout << max_i << std::endl;
}
0