結果
問題 | No.486 3 Straight Win(3連勝) |
ユーザー |
![]() |
提出日時 | 2020-08-18 17:55:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 920 bytes |
コンパイル時間 | 2,544 ms |
コンパイル使用メモリ | 93,156 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 03:00:49 |
合計ジャッジ時間 | 2,295 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <iomanip> #include <stack> #include <algorithm> #include <string> #include <map> #include <iterator> #include <set> #include <queue> #include <bitset> #include <cassert> using namespace std; int main() { string S; cin >> S; int N = S.size(); if (N < 3) { cout << "NA" << endl; } else { assert(N >= 1); pair<char, int> p; p.first = S[0]; p.second = 1; string res = "NA"; for (int i = 1; i < N; ++i) { if (p.first == S[i]) { p.second += 1; } else { p.first = S[i]; p.second = 1; } if (p.second == 3) { res = p.first == 'O' ? "East" : "West"; break; } } cout << res << endl; } return 0; }