結果
問題 | No.884 Eat and Add |
ユーザー |
![]() |
提出日時 | 2025-03-17 03:10:07 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 144 ms / 1,000 ms |
コード長 | 323 bytes |
コンパイル時間 | 377 ms |
コンパイル使用メモリ | 12,032 KB |
実行使用メモリ | 11,904 KB |
最終ジャッジ日時 | 2025-03-17 03:10:10 |
合計ジャッジ時間 | 2,218 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
ソースコード
N=list(input().strip()) N.reverse() N.append("0") N.append("0") ANS=0 ind=0 while ind<len(N): if N[ind]=="1" and N[ind+1]=="0": ANS+=1 ind+=1 elif N[ind]=="1" and N[ind+1]=="1": ANS+=1 while N[ind]=="1": ind+=1 N[ind]="1" else: ind+=1 print(ANS)