結果
| 問題 |
No.24 数当てゲーム
|
| コンテスト | |
| ユーザー |
Kuphony
|
| 提出日時 | 2016-03-16 22:47:47 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,632 bytes |
| コンパイル時間 | 521 ms |
| コンパイル使用メモリ | 65,156 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-01 08:48:34 |
| 合計ジャッジ時間 | 1,049 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 WA * 3 |
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main(int argc, const char * argv[]) {
int n;
cin >> n;
int array[n][4];
vector<string> strList;
string tmp;
int count = 0;
for(int i = 0; i < n*5;i++){
if(i%5 == 4){
cin >> tmp;
strList.push_back(tmp);
count++;
}
else{
cin >> array[count][i%5];
}
}
int yescount[10];
int nocount[10];
for (int i = 0; i < 10; i++) {
yescount[i] = 0;
nocount[i] = 0;
}
for (int i = 0; i < n; i++) {
if(strList[i] == "YES"){
for (int j = 0; j < 4; j++) {
yescount[array[i][j]]++;
}
}
else{
for (int j = 0; j < 4; j++) {
nocount[array[i][j]]++;
}
}
}
//ジャッジ
//判断のパターン
//1.1つを除きすべてNOになっている
//2.YESの回数が他より多い
int result = 0;
int tmpresult = 0;
//1番の判定
int tmpcount = 0;
for (int i = 0; i < 10; i++) {
if(nocount[i] == 0){
tmpresult = i;
}
else{
tmpcount++;
}
}
if(tmpcount == 9){
result = tmpresult;
}
//2番の判定
int tmpmax = 1;
for (int i = 0; i < 10; i++) {
if (yescount[i] > tmpmax && nocount[i] == 0) {
tmpmax = yescount[i];
tmpresult = i;
}
}
if(tmpmax >= 2){
result = tmpresult;
}
cout << result;
cout << "\n";
}
Kuphony