結果
| 問題 |
No.415 ぴょん
|
| ユーザー |
|
| 提出日時 | 2019-01-20 18:49:21 |
| 言語 | Nim (2.2.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 457 bytes |
| コンパイル時間 | 2,641 ms |
| コンパイル使用メモリ | 66,612 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-01 10:25:58 |
| 合計ジャッジ時間 | 3,768 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 WA * 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: 'algorithm' [UnusedImport]
ソースコード
import sequtils,strutils,algorithm,math
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
while true:
var k = getchar_unlocked()
if k < '0': break
result = 10 * result + k.ord - '0'.ord
let n = scan()
let d = scan()
# 1 .. n
# 1 -> 1 + d -> ... -> (1 + d * _) mod n (足場N=足場0)
let g = n.gcd(d)
if g == 1: # 無限
quit $(n-1), 0
if g == n: #
quit $(0), 0
echo(n div n.gcd(d) - 1)