結果

問題 No.423 ハムスター語初級(数詞)
ユーザー gorugo30gorugo30
提出日時 2021-02-23 21:27:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 343 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 81,672 KB
実行使用メモリ 53,348 KB
最終ジャッジ日時 2023-10-23 22:25:16
合計ジャッジ時間 1,430 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,348 KB
testcase_01 AC 33 ms
53,348 KB
testcase_02 AC 33 ms
53,348 KB
testcase_03 AC 34 ms
53,348 KB
testcase_04 AC 35 ms
53,348 KB
testcase_05 AC 33 ms
53,348 KB
testcase_06 AC 34 ms
53,348 KB
testcase_07 AC 34 ms
53,348 KB
testcase_08 AC 34 ms
53,348 KB
testcase_09 AC 39 ms
53,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ham = ["ham", "hamu"]
zo = {"ham": 0, "hamu": 1}
n = input()
x = 0
while len(n) > 0:
    if n.startswith(ham[1]):
        x *= 2
        x += 1
        n = n[4:]
    else:
        x *= 2
        n = n[3:]
x *= 2
gyaku = []
if x == 0:
    print("ham")
    exit()
while x > 0:
    gyaku.append(ham[x % 2])
    x //= 2
print("".join(gyaku[::-1]))
0