結果

問題 No.24 数当てゲーム
ユーザー shiratama
提出日時 2016-08-09 00:44:54
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 571 bytes
コンパイル時間 505 ms
コンパイル使用メモリ 62,908 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-07 07:31:24
合計ジャッジ時間 1,065 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <vector>

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

	std::vector<int> scores(10);
	std::vector<int> nums(N);
	std::string R;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < 4; ++j) {
			std::cin >> nums[j];
		}
		std::cin >> R;

		for (int j = 0; j < 4; ++j) {
			switch (R[0]) {
			case 'Y': scores[nums[j]]++; break;
			case 'N': scores[nums[j]]--; break;
			}
		}
	}

	int max_i = 0;
	for (int i = 1; i < 10; i++) {
		if (scores[i] > scores[max_i]) {
			max_i = i;
		}
	}

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