結果
| 問題 | No.3413 あわてんぼうのルクくん |
| コンテスト | |
| ユーザー |
回転
|
| 提出日時 | 2025-12-20 03:26:47 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 671 ms / 2,000 ms |
| コード長 | 395 bytes |
| 記録 | |
| コンパイル時間 | 326 ms |
| コンパイル使用メモリ | 82,780 KB |
| 実行使用メモリ | 77,712 KB |
| 最終ジャッジ日時 | 2025-12-20 03:26:57 |
| 合計ジャッジ時間 | 10,290 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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#%E7%AD%89%E5%B7%AE%E6%95%B0%E5%88%97
from math import gcd
Q = int(input())
for _ in range(Q):
x,n,d = list(map(int,input().split()))
if(gcd(x,d) != 1):
print("inf")
else:
print(((x-2)//n + 1) * x + (d-1) * (x-1) - 1)
回転