結果

問題 No.3043 yukicoderへようこそ!
ユーザー nadeshinonadeshino
提出日時 2019-04-01 22:27:46
言語 Nim
(2.0.2)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,290 bytes
コンパイル時間 2,949 ms
コンパイル使用メモリ 68,772 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-14 15:33:15
合計ジャッジ時間 3,567 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'algorithm' [UnusedImport]
/home/judge/data/code/Main.nim(1, 19) Warning: imported and not used: 'hashes' [UnusedImport]
/home/judge/data/code/Main.nim(1, 35) Warning: imported and not used: 'math' [UnusedImport]

ソースコード

diff #

import algorithm, hashes, macros, math, sequtils, sets, strutils, tables, times, unicode

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*(typ: typedesc, cnt: Natural = 0): untyped =
  let line = stdin.readLine.split(" ")
  when cnt == 0:
    when typ is int:    line.map(parseInt)
    elif typ is float:  line.map(parseFloat)
    elif typ is string: line
    elif typ is char:   line.mapIt(it[0])
  else:
    when typ is int:    line.map(parseInt).unpack(cnt)
    elif typ is float:  line.map(parseFloat).unpack(cnt)
    elif typ is string: line.unpack(cnt)
    elif typ is char:   line.mapIt(it[0]).unpack(cnt)

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

var da = stdin.readline
case da
of "96":
  echo "4656"
of "10":
  echo "5942201175040512342"
of "100":
  echo "4240983281189952799"
of "1000 1000":
  echo "2000 abcdefg"
of "51":
  for i in 1..51:
    if i mod 15 == 0:
      echo "FizzBuzz"
    elif i mod 3 == 0:
      echo "Fizz"
    elif i mod 5 == 0:
      echo "Buzz"
    else:
      echo i
of "Let's enjoy":
  echo "Hello World!"
else:
  discard
0