結果

問題 No.423 ハムスター語初級(数詞)
ユーザー Shoya SATOShoya SATO
提出日時 2020-10-09 15:28:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 693 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 10,808 KB
実行使用メモリ 7,944 KB
最終ジャッジ日時 2023-09-27 12:41:55
合計ジャッジ時間 1,016 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#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:
  #print(z)
  if z<2**e:
    c+='0'
    #print('z<2**e')
  else:
    while z>2**(e+1):
      e+=1
      #print('e+=1')
  z-=2**e
  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)
0