結果

問題 No.486 3 Straight Win(3連勝)
ユーザー ilplrr
提出日時 2018-02-18 17:14:42
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 434 bytes
コンパイル時間 671 ms
コンパイル使用メモリ 56,928 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-26 04:38:39
合計ジャッジ時間 1,442 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
using namespace std;

int main()
{
    string s; cin >> s;

    int e = 0, w = 0;
    char t = '-';
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != t) e = 0, w = 0;
        (s[i] == 'O' ? e : w) ++;
        t = s[i];
        if (e >= 3) return puts("East"), 0;
        if (w >= 3) return puts("West"), 0;
    }
    puts("NA");

    return 0;
}
0