結果

問題 No.380 悪の台本
ユーザー htkb
提出日時 2019-02-08 11:49:42
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 244 ms / 1,000 ms
コード長 646 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-06-27 16:05:07
合計ジャッジ時間 1,772 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import re
suffix = {"digi": "nyo", "petit": "nyu", "rabi": "", "gema": "gema", "piyo": "pyo"}

for line in sys.stdin:
    converted = ""
    chara = line.split(" ")[0]
    line = line[len(chara)+1:-1]

    for c, kc in zip(line.lower(), (ord(c) for c in line)):
        if not (48 <= kc <= 57 or 65 <= kc <= 90 or 97 <= kc <= 122):
            c = "!"
        converted += c

    if chara in suffix and (
            chara == "rabi" and len(converted) != converted.count("!") or\
            chara != "rabi" and re.search("%s!{0,3}$" % suffix[chara], converted)
    ):
        print("CORRECT (maybe)")
    else:
        print("WRONG!")
0