結果
問題 | No.884 Eat and Add |
ユーザー |
![]() |
提出日時 | 2019-09-13 22:02:37 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 5 ms / 1,000 ms |
コード長 | 481 bytes |
コンパイル時間 | 3,626 ms |
コンパイル使用メモリ | 64,860 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-04 09:41:59 |
合計ジャッジ時間 | 4,546 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport] /home/judge/data/code/Main.nim(1, 17) Warning: imported and not used: 'strutils' [UnusedImport]
ソースコード
import sequtils,strutilsvarN = "0" & stdin.readlinef : boolcnt = 0for i in countdown(N.high, 1):if N[i] == '1':if f == true and N[i - 1] == '1':continueelif f == false and N[i - 1] == '1':f = truecnt += 1elif f == true and N[i - 1] == '0':N[i - 1] = '1'f = falseelif f == false and N[i - 1] == '0':cnt += 1if N[0] == '1':cnt += 1echo cnt