結果

問題 No.380 悪の台本
ユーザー xkumiyu
提出日時 2018-06-15 21:41:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 672 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-06-30 14:58:00
合計ジャッジ時間 1,661 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 7 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.py:4: SyntaxWarning: invalid escape sequence '\s'
  'digi': re.compile('(n|N)(y|Y)(o|O)([!-/:-@[-`{-~]|\s){0,3}$'),
Main.py:5: SyntaxWarning: invalid escape sequence '\s'
  'petit': re.compile('(n|N)(y|Y)(u|U)([!-/:-@[-`{-~]|\s){0,3}$'),
Main.py:6: SyntaxWarning: invalid escape sequence '\w'
  'rabi': re.compile('\w'),
Main.py:7: SyntaxWarning: invalid escape sequence '\s'
  'gema': re.compile('(g|G)(e|E)(m|M)(a|A)([!-/:-@[-`{-~]|\s){0,3}$'),
Main.py:8: SyntaxWarning: invalid escape sequence '\s'
  'piyo': re.compile('(p|P)(y|Y)(o|O)([!-/:-@[-`{-~]|\s){0,3}$')

ソースコード

diff #

import re

ptn = {
    'digi': re.compile('(n|N)(y|Y)(o|O)([!-/:-@[-`{-~]|\s){0,3}$'),
    'petit': re.compile('(n|N)(y|Y)(u|U)([!-/:-@[-`{-~]|\s){0,3}$'),
    'rabi': re.compile('\w'),
    'gema': re.compile('(g|G)(e|E)(m|M)(a|A)([!-/:-@[-`{-~]|\s){0,3}$'),
    'piyo': re.compile('(p|P)(y|Y)(o|O)([!-/:-@[-`{-~]|\s){0,3}$')
}


def check(s):
    s = s.split()
    if len(s) < 2:
        return False
    if s[0] in ptn.keys() and ptn[s[0]].search(' '.join(s[1:])):
        return True
    else:
        return False


try:
    while True:
        if check(input()):
            print('CORRECT (maybe)')
        else:
            print('WRONG!')
except EOFError:
    pass
0