結果

問題 No.99 ジャンピング駒
ユーザー むらため
提出日時 2019-01-16 19:15:22
言語 Nim
(2.2.0)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 448 bytes
コンパイル時間 2,170 ms
コンパイル使用メモリ 60,944 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-01 06:32:02
合計ジャッジ時間 2,748 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

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 pre.ord mod 2 == 0: p += 1
    else: p -= 1
  if c.ord == 255: break
  pre = c
printf("%d\n",p.abs)
0