結果

問題 No.882 約数倍数
ユーザー nadeshinonadeshino
提出日時 2019-09-14 13:54:04
言語 Nim
(2.0.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,489 bytes
コンパイル時間 2,219 ms
コンパイル使用メモリ 62,940 KB
最終ジャッジ日時 2023-09-19 09:43:12
合計ジャッジ時間 2,765 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 19) Warning: Use the new 'sugar' module instead; future is deprecated [Deprecated]
stack trace: (most recent call last)
Main.nim(6, 9)           unpack
/home/judge/data/code/Main.nim(34, 19) template/generic instantiation of `input` from here
/home/judge/data/code/Main.nim(12, 44) template/generic instantiation of `unpack` from here
/home/judge/data/code/Main.nim(6, 9) Error: index 1 not in 0 .. 0

ソースコード

diff #

import algorithm, future, macros, math, sequtils, sets, strutils, tables

macro unpack(rhs: seq, cnt: static[int]): auto =
  let t = genSym(); result = quote do:(let `t` = `rhs`;())
  if NimMinor <= 17:
    for i in 0..<cnt: result[0][1].add(quote do:`t`[`i`])
  else:
    for i in 0..<cnt: result[1].add(quote do:`t`[`i`])

template input(T: typedesc, cnt: Natural = 1): untyped =
  let line = stdin.readLine.split(" ")
  when T is int:         line.map(parseInt).unpack(cnt)
  elif T is float:       line.map(parseFloat).unpack(cnt)
  elif T is string:      line.unpack(cnt)
  elif T is char:        line.mapIt(it[0]).unpack(cnt)
  elif T is seq[int]:    line.map(parseint)
  elif T is seq[float]:  line.map(parseFloat)
  elif T is seq[string]: line
  elif T is seq[char]:   line.mapIt(it[0])

proc `&=`(n: var int, m: int) = n = n and m
proc `|=`(n: var int, m: int) = n = n or m
proc `%=`(n: var int, m: int) = n = n mod m
proc `//=`(n: var int, m: int) = n = n div m
proc `<<=`(n: var int, m: int) = n = n shl m
proc `>>=`(n: var int, m: int) = n = n shr m
proc `<?=`(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)))

# -------------------------------------------------- #

var (A, B) = input(int, 2)
echo (if A mod B == 0: "YES" else: "NO")
0