結果
| 問題 |
No.486 3 Straight Win(3連勝)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-24 22:49:37 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 607 bytes |
| コンパイル時間 | 429 ms |
| コンパイル使用メモリ | 54,108 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-26 04:03:29 |
| 合計ジャッジ時間 | 1,312 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 |
ソースコード
#include<iostream>
using namespace std;
int now = 0, straight = 0, type = 0, winner[101] = {};
char s[101];
bool win = false;
int main(){
cin >> s;
while (s[now] != 0){
if (s[now] == 'O'){
winner[now] = 1;
}
if (s[now] == 'X'){
winner[now] = 2;
}
now++;
}
now = 0;
while (winner[now] != 0){
if (type == winner[now]){
straight++;
if (straight == 3){
win = true;
break;
}
}
else{
straight = 1;
type = winner[now];
}
now++;
}
if (win){
if (type == 1){
cout << "East";
}
else{
cout << "West";
}
}
else{
cout << "NA";
}
return 0;
}