結果

問題 No.423 ハムスター語初級(数詞)
ユーザー kawacchukawacchu
提出日時 2019-10-05 17:25:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 407 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-16 01:48:54
合計ジャッジ時間 860 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

S = input() + "h"
N = len(S) - 1
zero = "ham"
one = "hamu"

a = ""
tmp = 0
for i,s in enumerate(S[1:]) :
    tmp += 1
    if s == "h" :
        if i - tmp == 3 :
            a += "0"
        else :
            a += "1"
        tmp = 0

b = 0
for i,s in enumerate(a[::-1]) :
    if s == "1" :
        b += 2 ** i
b *= 2
ans = ""
for s in str(bin(b)[2:]) :
    ans += "ham" if s == "0" else "hamu"
print(ans)
0