結果
| 問題 | No.884 Eat and Add |
| コンテスト | |
| ユーザー |
6soukiti29
|
| 提出日時 | 2019-09-13 22:02:37 |
| 言語 | Nim (2.2.8) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| + 339µs | |
| コード長 | 481 bytes |
| 記録 | |
| コンパイル時間 | 3,037 ms |
| コンパイル使用メモリ | 67,356 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-08-06 07:05:45 |
| 合計ジャッジ時間 | 4,008 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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