結果
問題 |
No.8081 HQ9+
|
ユーザー |
|
提出日時 | 2021-04-01 22:07:58 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 963 bytes |
コンパイル時間 | 93 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-12-21 06:26:12 |
合計ジャッジ時間 | 1,551 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 2 |
other | RE * 21 |
ソースコード
#!/bin/python3 import sys if len(sys.argv)<=1: print('Usage: python3 HQ9p.py codefile',file=sys.stderr) exit(1) with open(sys.argv[1]) as codefile: code=codefile.readline().rstrip('\n') accumulator=0 for op in code: if op=='H': print('Hello, World!',flush=True) elif op=='Q': print(code,end='',flush=True) elif op=='9': for i in range(99,1,-1): print(str(i) +' bottles of beer on the wall, ' +str(i) +' bottles of beer.\n' +'Take one down, pass it around, ' +str(i-1) +(' bottle' if i-1==1 else ' bottles') +' of beer on the wall.\n',flush=True) print('1 bottle of beer on the wall, ' +'1 bottle of beer.\n' +'Take one down, pass it around, ' +'No bottles of beer on the wall.',flush=True) elif op=='+': accumulator+=1 else: print(-1)