結果
| 問題 | No.3413 あわてんぼうのルクくん |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2026-02-13 21:10:31 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 241 ms / 2,000 ms |
| コード長 | 351 bytes |
| 記録 | |
| コンパイル時間 | 385 ms |
| コンパイル使用メモリ | 82,220 KB |
| 実行使用メモリ | 76,792 KB |
| 最終ジャッジ日時 | 2026-02-13 21:10:38 |
| 合計ジャッジ時間 | 5,750 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 15 |
ソースコード
from sys import stdin
input = stdin.readline
from math import gcd
def inverse(n, d, MOD):
return n * pow(d, -1, MOD) % MOD
for _ in range(int(input())):
X, N, D = map(int, input().split())
if gcd(X, D) != 1:
print("inf")
continue
if X == 1:
print(-1)
continue
print(((X-2)//N+1)*X+(D-1)*(X-1)-1)
detteiuu