結果
問題 | No.380 悪の台本 |
ユーザー | rpy3cpp |
提出日時 | 2016-06-17 23:55:15 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,431 bytes |
コンパイル時間 | 97 ms |
コンパイル使用メモリ | 10,944 KB |
実行使用メモリ | 8,484 KB |
最終ジャッジ日時 | 2023-08-06 19:42:56 |
合計ジャッジ時間 | 1,144 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
7,796 KB |
testcase_01 | WA | - |
testcase_02 | AC | 16 ms
7,832 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 86 ms
8,064 KB |
testcase_08 | AC | 29 ms
8,484 KB |
testcase_09 | WA | - |
ソースコード
import sys def solve(line): if len(line) < 5: return False name = line[:5] if name == 'digi ': return ends_with(line[5:].lower(), 'nyo') elif name == 'petit': return (line[5] != ' ') and ends_with(line[6:].lower(), 'nyu') elif name == 'rabi ': return solve_rabi(line[5:].lower()) elif name == 'gema ': return ends_with(line[5:].lower(), 'gema') elif name == 'piyo ': return ends_with(line[5:].lower(), 'pyo') else: return False def ends_with(line, txt): n = len(line) if n < len(txt): return False if line.endswith(txt): return True elif n >= 1 and is_symbol(line[-1]): if line[:-1].endswith(txt): return True elif n >= 2 and is_symbol(line[-2]): if line[:-2].endswith(txt): return True elif n >= 3 and is_symbol(line[-3]): if line[:-3].endswith(txt): return True return False def is_symbol(char): ordc = ord(char) if 48 <= ordc <= 57 or 65 <= ordc <= 90 or 97 <= ordc <= 122: return False return True def solve_rabi(line): for c in line: if not is_symbol(c): return True return False if __name__ == '__main__': for line in sys.stdin: if solve(line.strip()): print('CORRECT (maybe)') else: print('WRONG!')