結果

問題 No.486 3 Straight Win(3連勝)
ユーザー nanae
提出日時 2017-02-24 22:26:54
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 628 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-06-26 03:59:17
合計ジャッジ時間 2,023 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    S = input()
    N = len(S)

    cnt_o = 0
    cnt_x = 0

    for c in S:
        if c == 'O':
            cnt_x = 0
            cnt_o += 1
            if cnt_o >= 3:
                print('East')
                return None
        else:
            cnt_o = 0
            cnt_x += 1
            if cnt_x >= 3:
                print('West')
                return None

    print('NA')


if __name__ == '__main__':
    solve()
0