結果
問題 |
No.423 ハムスター語初級(数詞)
|
ユーザー |
![]() |
提出日時 | 2020-10-09 11:15:16 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 644 bytes |
コンパイル時間 | 84 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-07-20 06:43:38 |
合計ジャッジ時間 | 1,071 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 8 RE * 1 |
ソースコード
#ham=0 hamu=1 hamstring=大腿後面筋 n=list(input()) n+=['string'] y=0 b=[] #print(n) for _ in n: if n[y] =='m': if n[y+1]=='h': b+=[0] elif n[y+1]=='u': b+=[1] y+=1 #print(b) if b[0]==0: b.pop(0) b_len=len(b)-1 z=0 for x in b: z+=x*(2**b_len) b_len-=1 #print(z) z*=2 #print(z) c='' d=2 e=0 while z >1: if z<2**e: c+='0' else: while z>d*2: d=2**e e+=1 z-=d e-=1 d=2 c+='1' # print(z) if z ==1: c+='1' else: c+='0' c_list=list(c) print_ham='' for x in c_list: if x =='1': print_ham+='hamu' else: print_ham+='ham' print(print_ham)