結果
問題 | No.1113 二つの整数 / Two Integers |
ユーザー |
|
提出日時 | 2020-07-17 21:26:05 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,235 bytes |
コンパイル時間 | 3,940 ms |
コンパイル使用メモリ | 65,764 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-30 06:27:19 |
合計ジャッジ時間 | 4,055 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport] /home/judge/data/code/Main.nim(1, 17) Warning: imported and not used: 'strutils' [UnusedImport] /home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'sugar' [UnusedImport] /home/judge/data/code/Main.nim(1, 32) Warning: imported and not used: 'algorithm' [UnusedImport]
ソースコード
import sequtils,strutils,sugar,algorithm,bitops,mathproc scanf*(formatstr: cstring){.header: "<stdio.h>", importc: "scanf", varargs.}proc nextInt*(): int32 = scanf("%d", addr result)proc nextLong*(): int64 = scanf("%lld", addr result)proc nextFloat*(): float64 = scanf("%lf", addr result)proc getchar*(): char {.header: "<stdio.h>", importc: "getchar".}proc nextChar*(): char =while true:let c = getchar()if c.ord >= 0x21 and c.ord <= 0x7e:result = cbreakproc nextStr*(): string =var ok = falsewhile true:let c = getchar()if c.ord >= 0x21 and c.ord <= 0x7e: ok = trueelif ok: breakif ok:result.add(c)const LOCAL {.booldefine.} = falsetemplate `max=`*(x, y) = x = max(x, y)template `min=`*(x, y) = x = min(x, y)template times*(n: int; body: untyped): untyped = (for _ in 0 ..< n: body)proc `<-`*[T, U](a: var T, b: U): var T =a = breturn atemplate `<<`(a: untyped, b: int): untyped = (a shl b)template `>>`(a: untyped, b: int): untyped = (a shr b)proc is_square(n: int64): bool =let x = n.float.sqrt.int64return x * x == nlet a = nextlong()let b = nextlong()let n = gcd(a, b)if n.is_square:echo "Odd"else:echo "Even"