結果

問題 No.380 悪の台本
ユーザー しらっ亭
提出日時 2016-06-18 00:37:22
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 664 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-11-06 22:51:25
合計ジャッジ時間 1,043 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1 WA * 5 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import re
import sys

re_digi = r'nyo[^a-z]{0,3}$'
re_petit = r'nyu[^a-z]{0,3}$'
re_rabi = r'[a-z]'
re_gema = r'gema[^a-z]{0,3}$'
re_piyo = r'pyo[^a-z]{0,3}$'

name_re = {'digi': re_digi, 'petit': re_petit, 'rabi': re_rabi, 'gema': re_piyo, 'piyo': re_piyo}


def check(text):
    text = text.lower()
    name = text.split()[0]
    if name.lower() not in name_re:
        return False
    pat = name_re[name]
    serif = text[len(name):]
    return re.search(pat, serif)


def solve():
    for l in sys.stdin:
        if check(l.rstrip('\n')):
            print('CORRECT (maybe)')
        else:
            print('WRONG!')


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