結果
問題 | No.1047 Zero (Novice) |
ユーザー |
![]() |
提出日時 | 2020-05-08 21:32:27 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,665 bytes |
コンパイル時間 | 4,399 ms |
コンパイル使用メモリ | 71,248 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-04 00:01:06 |
合計ジャッジ時間 | 4,028 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'algorithm' [UnusedImport] /home/judge/data/code/Main.nim(1, 27) Warning: imported and not used: 'math' [UnusedImport]
ソースコード
import algorithm, macros, math, sequtils, strutils, tables# import bitops, lenientops, deques,# heapqueue, sets, sugarlet read* = iterator: string =while true: (for s in stdin.readLine.split: yield s)template input*(T: static[typedesc]): untyped =when T is int: read().parseIntelif T is float: read().parseFloatelif T is string: read()elif T is char: read()[0]macro dump*(args: varargs[typed]): untyped =result = newNimNode(nnkStmtList)for x in args:let s = toStrLit(x)result.add quote do: stderr.write `s`, " = ", `x`, " "result.add quote do: stderr.write "\n"proc `|=`*(n: var int, m: int) = n = n or mproc `|=`*(n: var bool, m: bool) = n = n or mproc `&=`*(n: var int, m: int) = n = n and mproc `&=`*(n: var bool, m: bool) = n = n and mproc `^=`*(n: var int, m: int) = n = n xor mproc `^=`*(n: var bool, m: bool) = n = n xor mproc `%=`*(n: var int, m: int) = n = n mod mproc `/=`*(n: var int, m: int) = n = n div mproc `<<=`*(n: var int, m: int) = n = n shl mproc `>>=`*(n: var int, m: int) = n = n shr mproc `<?=`*(n: var SomeNumber, m: SomeNumber) = n = min(n, m)proc `>?=`*(n: var SomeNumber, m: SomeNumber) = n = max(n, m)proc newSeq2*[T](n1, n2: Natural): seq[seq[T]] = newSeqWith(n1, newSeq[T](n2))proc newSeq3*[T](n1, n2, n3: Natural): seq[seq[seq[T]]] = newSeqWith(n1, newSeqWith(n2, newSeq[T](n3)))proc newSeq4*[T](n1, n2, n3, n4: Natural): seq[seq[seq[seq[T]]]] = newSeqWith(n1, newSeqWith(n2, newSeqWith(n3, newSeq[T](n4))))# -------------------------------------------------- #let A, B = input(int)if B == 0:echo 1elif A == 1:echo "-1"elif A == -1:echo 2else:echo "-1"