結果

問題 No.99 ジャンピング駒
ユーザー むらためむらため
提出日時 2019-01-16 19:20:54
言語 Nim
(2.0.2)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 459 bytes
コンパイル時間 2,442 ms
コンパイル使用メモリ 66,392 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-13 22:15:46
合計ジャッジ時間 2,750 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
4,380 KB
testcase_01 AC 6 ms
4,376 KB
testcase_02 AC 6 ms
4,376 KB
testcase_03 AC 5 ms
4,376 KB
testcase_04 AC 5 ms
4,380 KB
testcase_05 AC 6 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

proc printf(formatstr: cstring){.header: "<stdio.h>", varargs.}
proc scanf(formatstr: cstring){.header: "<stdio.h>", varargs.}
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
var n :int32
scanf("%d\n",addr n)
var p = 0
var pre : char
while true:
  var c = getchar_unlocked()
  if c.ord == 32 or c.ord == 10:
    if (cast[int16](pre) and 1) == 0: p += 1
    else: p -= 1
  if c.ord == 255: break
  pre = c
printf("%d\n",p.abs)
0