結果
| 問題 | No.3413 あわてんぼうのルクくん |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2025-12-20 05:29:21 |
| 言語 | Python3 (3.14.2 + numpy 2.4.0 + scipy 1.16.3) |
| 結果 |
AC
|
| 実行時間 | 600 ms / 2,000 ms |
| コード長 | 462 bytes |
| 記録 | |
| コンパイル時間 | 1,740 ms |
| コンパイル使用メモリ | 12,160 KB |
| 実行使用メモリ | 10,368 KB |
| 最終ジャッジ日時 | 2025-12-20 05:29:32 |
| 合計ジャッジ時間 | 9,293 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 15 |
ソースコード
# https://ja.wikipedia.org/wiki/%E3%83%95%E3%83%AD%E3%83%99%E3%83%8B%E3%82%A6%E3%82%B9%E3%81%AE%E7%A1%AC%E8%B2%A8%E4%BA%A4%E6%8F%9B%E5%95%8F%E9%A1%8C
import sys
input = sys.stdin.readline
from math import gcd,lcm
Q=int(input())
for tests in range(Q):
X,N,d=map(int,input().split())
if X==1:
print(-1)
continue
if gcd(X,d)!=1:
print("inf")
continue
ANS=((X-2)//N+1)*X+(d-1)*(X-1)-1
print(ANS)
titia