結果
問題 |
No.486 3 Straight Win(3連勝)
|
ユーザー |
![]() |
提出日時 | 2018-02-27 10:09:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 708 bytes |
コンパイル時間 | 583 ms |
コンパイル使用メモリ | 64,716 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 04:39:29 |
合計ジャッジ時間 | 1,403 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
// No.486 3 Straight Win(3連勝) // https://yukicoder.me/problems/no/486 // #include <iostream> #include <string> using namespace std; string solve(string &S); int main() { string S; cin >> S; string ans = solve(S); cout << ans << endl; } string solve(string &S) { const string WEST_WIN = "XXX"; const string EAST_WIN = "OOO"; auto w_pos = S.find(WEST_WIN); auto e_pos = S.find(EAST_WIN); if (w_pos == string::npos) { if (e_pos == string::npos) return "NA"; else return "East"; } else { if (e_pos == string::npos) return "West"; else return (w_pos < e_pos? "West": "East"); } }