結果
| 問題 |
No.884 Eat and Add
|
| コンテスト | |
| ユーザー |
6soukiti29
|
| 提出日時 | 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,strutils
var
N = "0" & stdin.readline
f : bool
cnt = 0
for i in countdown(N.high, 1):
if N[i] == '1':
if f == true and N[i - 1] == '1':
continue
elif f == false and N[i - 1] == '1':
f = true
cnt += 1
elif f == true and N[i - 1] == '0':
N[i - 1] = '1'
f = false
elif f == false and N[i - 1] == '0':
cnt += 1
if N[0] == '1':
cnt += 1
echo cnt
6soukiti29