結果

問題 No.486 3 Straight Win(3連勝)
ユーザー vwxyz
提出日時 2022-08-08 21:36:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 551 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-09-19 06:05:15
合計ジャッジ時間 2,115 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline

def Run_Length(lst):
    run_length=[]
    if lst:
        prev=lst[0]
        cnt=1
        for x in lst[1:]:
            if x==prev:
                cnt+=1
            else:
                run_length.append((prev,cnt))
                prev=x
                cnt=1
        run_length.append((prev,cnt))
    return run_length

S=readline().rstrip()
for s,c in Run_Length(S):
    if c>=3:
        if s=="O":
            ans="East"
        else:
            ans="West"
        break
else:
    ans="NA"
print(ans)
0