結果

問題 No.380 悪の台本
ユーザー TatamoTatamo
提出日時 2016-07-05 18:52:02
言語 Python2
(2.7.18)
結果
AC  
実行時間 214 ms / 1,000 ms
コード長 1,418 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 6,680 KB
実行使用メモリ 6,564 KB
最終ジャッジ日時 2023-08-06 20:01:08
合計ジャッジ時間 1,198 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,020 KB
testcase_01 AC 12 ms
5,864 KB
testcase_02 AC 12 ms
6,008 KB
testcase_03 AC 13 ms
5,876 KB
testcase_04 AC 19 ms
6,100 KB
testcase_05 AC 48 ms
6,240 KB
testcase_06 AC 34 ms
6,164 KB
testcase_07 AC 214 ms
6,564 KB
testcase_08 AC 13 ms
6,124 KB
testcase_09 AC 20 ms
5,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import re
script = sys.stdin.readlines()

rule = {
    "digi":  "nyo",
    "petit": "nyu",
    "rabi": "",
    "gema": "gema",
    "piyo": "pyo"
}

not_kigou_re = re.compile("[0-9a-zA-Z]")

wrong = "WRONG!"
correct = "CORRECT (maybe)"

for line in script :
    line = line.rstrip("\n")
    flg = False
    for chara in rule :
        gobi = rule[chara]
        if(line.startswith(chara)) :
            flg = True
            line = line[len(chara):]
            if(len(line) == 0 or line[0] != " "):
                flg = False
                break
            #print "chara:",chara,"gobi:",gobi
            #print "line:" ,line
            #print "usiro:" ,line[:3+len(gobi)]
            if(chara == "rabi") :
                if(not_kigou_re.search(line) == None):
                    print wrong
                else:
                    print correct
            else :
                flg2 = False
                for x in range(4):
                    if(gobi == line[(len(gobi))*-1:].lower()):
                        flg2 = True
                        print correct
                        break
                    else:
                        if(not_kigou_re.match(line[-1:]) == None):
                            line = line[:-1]
                        else :
                            break
                if(not flg2):
                    print wrong
    if(not flg):
        print wrong
0