結果

問題 No.884 Eat and Add
ユーザー momotaros300momotaros300
提出日時 2019-09-13 23:23:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 137 ms / 1,000 ms
コード長 302 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 10,664 KB
実行使用メモリ 12,728 KB
最終ジャッジ日時 2023-09-17 15:22:14
合計ジャッジ時間 1,687 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,776 KB
testcase_01 AC 17 ms
7,852 KB
testcase_02 AC 15 ms
7,928 KB
testcase_03 AC 120 ms
12,580 KB
testcase_04 AC 120 ms
12,588 KB
testcase_05 AC 110 ms
12,716 KB
testcase_06 AC 124 ms
12,728 KB
testcase_07 AC 100 ms
12,720 KB
testcase_08 AC 113 ms
12,708 KB
testcase_09 AC 137 ms
12,688 KB
testcase_10 AC 16 ms
7,816 KB
testcase_11 AC 16 ms
7,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=list(map(int,list(input())))
n2=n[::-1]+[0]
n3=[]
# print(n,n2)
count=0
for i in range(len(n2)-1):
    if n2[i]==2:
        n2[i]=0
        n2[i+1]+=1
    elif n2[i]==1 and n2[i+1]==1:
        n2[i],n2[i+1]=0,2
        count+=1
    else:pass
for i in n2:
    if i==1:
        count+=1
print(count)


0