結果

問題 No.380 悪の台本
ユーザー tookunn_1213
提出日時 2016-09-29 17:52:20
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 992 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-11-06 23:15:15
合計ジャッジ時間 1,143 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 3 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def delEnd(sentence):
	i = len(sentence) - 1
	cnt = 0
	while cnt < 3 and i >= 0:
		if sentence[i].isalnum():
			break
		i-=1
		cnt+=1
	return sentence[0:i + 1]
def isdigi(s):
	return s[-3:] == 'nyo'
def ispetit(s):
	return s[-3:] == 'nyu'
def isgema(s):
	return s[-4:] == 'gema'
def ispiyo(s):
	return s[-3:] == 'pyo'
def israbi(s):
	for i in s:
		if i.isalnum():
			return True
	return False
def getName(sentence):
	sentence = delEnd(sentence.lower())
	if isdigi(sentence):
		return 'digi'
	if ispetit(sentence):
		return 'petit'
	if isgema(sentence):
		return 'gema'
	if ispiyo(sentence):
		return 'piyo'
	if israbi(sentence):
		return 'rabi'
	return ''
S = sys.stdin.readlines()
for ss in S:
	s = ss[:-1]
	if len(s.split()) <= 1:
		print('WRONG!')
		continue
	s1 = s[:s.index(' ')]
	s2 = s[s.index(' ') + 1:]
	if s1 == 'digi' or s1 == 'petit' or s1 == 'rabi' or s1 == 'gema' or s1 == 'piyo':
		print('CORRECT (maybe)' if getName(s2) == s1 else 'WRONG!')
	else:
		print('WRONG!')
0