結果
問題 |
No.486 3 Straight Win(3連勝)
|
ユーザー |
![]() |
提出日時 | 2019-03-04 16:38:38 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 616 bytes |
コンパイル時間 | 514 ms |
コンパイル使用メモリ | 55,512 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-23 13:34:52 |
合計ジャッジ時間 | 1,404 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
#include <iostream> #include <string> int main() { std::string S; std::cin >> S; int W = 0; int E = 0; int WinFlag = 0; bool Flag = false; for (int i = 0; i < S.size(); i++) { if (S.at(i) == 'O') { E++; W = 0; if (E >= 3 && Flag == false) { WinFlag = 2; Flag = true; } } if (S.at(i) == 'X') { W++; E = 0; if (W >= 3 && Flag == false) { WinFlag = 1; Flag = true; } } } if (WinFlag == 1) { std::cout << "West" << std::endl; } if (WinFlag == 2) { std::cout << "East" << std::endl; } if (WinFlag == 0) { std::cout << "NA" << std::endl; } return 0; }