結果
| 問題 | No.3413 あわてんぼうのルクくん |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-20 01:03:01 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 101 ms / 2,000 ms |
| コード長 | 686 bytes |
| 記録 | |
| コンパイル時間 | 2,061 ms |
| コンパイル使用メモリ | 194,992 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-12-20 01:03:07 |
| 合計ジャッジ時間 | 5,946 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 15 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int T;
cin >> T;
while(T--){
ll x, n, d;
cin >> x >> n >> d;
ll g = gcd(x, d);
if(g != 1){
cout << "inf\n";
continue;
}
if(x == 1){
cout << "-1\n";
continue;
}
// x の倍数
// d の倍数
// は作れる?
// dの個数は A <= d <= N * A以内の制約
// フロベニウスっぽい問題
ll k = (x - 2) / n + 1, ans = k * x + (d - 1) * (x - 1) - 1;
cout << ans << '\n';
}
}