結果

問題 No.380 悪の台本
ユーザー kurenai3110
提出日時 2017-01-31 22:59:49
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 1,003 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-11-06 23:22:04
合計ジャッジ時間 1,266 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import re

di = re.compile(r'\n[^a-zA-Z0-9]{0,3}(o|O)(y|Y)(n|N)')
pe = re.compile(r'\n[^a-zA-Z0-9]{0,3}(u|U)(y|Y)(n|N)')
ra = re.compile(r'\n.*[a-zA-Z0-9]+.* ')
ge = re.compile(r'\n[^a-zA-Z0-9]{0,3}(a|A)(m|M)(e|E)(g|G)')
pi = re.compile(r'\n[^a-zA-Z0-9]{0,3}(o|O)(y|Y)(p|P)')

AC='CORRECT (maybe)'
WA='WRONG!'

def solve(pattern,s):
    if re.match(pattern,s):
        return True
    return False

for s in sys.stdin:
    words = s.split()
    if len(words)<=1:
        print(WA)
        continue

    flag = False
    if solve('digi',s):
        if solve(di,s[::-1]):
            flag=True
    elif solve('petit',s):
        if solve(pe,s[::-1]):
            flag=True
    elif solve('rabi',s):
        if solve(ra,s[::-1]):
            flag=True       
    elif solve('gema',s):
        if solve(ge,s[::-1]):
            flag=True        
    elif solve('piyo',s):
        if solve(pi,s[::-1]):
            flag=True
            
    if flag:
        print(AC)
    else:
        print(WA)
0