結果

問題 No.423 ハムスター語初級(数詞)
ユーザー tomatonosuketomatonosuke
提出日時 2016-09-23 00:07:52
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 479 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 10,916 KB
実行使用メモリ 7,924 KB
最終ジャッジ日時 2023-08-11 02:57:45
合計ジャッジ時間 1,001 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,884 KB
testcase_01 AC 16 ms
7,856 KB
testcase_02 AC 15 ms
7,804 KB
testcase_03 AC 15 ms
7,780 KB
testcase_04 AC 16 ms
7,804 KB
testcase_05 AC 16 ms
7,852 KB
testcase_06 AC 16 ms
7,828 KB
testcase_07 AC 16 ms
7,856 KB
testcase_08 AC 16 ms
7,900 KB
testcase_09 AC 16 ms
7,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

targ = input()
temp = ""
num = ""
for t in range(len(targ)):
    temp += targ[t]
    if temp == "hamh":
        temp = "h"
        num += '0'
    elif temp == "hamu":
        temp = ""
        num += '1'
    elif temp == "ham" and t == len(targ) - 1:
        num += '0'
if num == '0':
    print("ham")
else:    
    temp = bin(int(num,2) * 2)[2:]
    ans = ""
    for t in temp:
        if t == '0':
            ans += "ham"
        else:
            ans += "hamu"
    print(ans)
0