結果
| 問題 | No.3413 あわてんぼうのルクくん |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-21 23:21:13 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 61 ms / 2,000 ms |
| + 386µs | |
| コード長 | 474 bytes |
| 記録 | |
| コンパイル時間 | 1,196 ms |
| コンパイル使用メモリ | 208,260 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-19 17:44:21 |
| 合計ジャッジ時間 | 5,603 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 15 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
const int N = 2000010, MOD = 998244353, INF = 0x3f3f3f3f;
int n, m, w[N];
int main() {
scanf("%d", &m);
while (m--) {
int x, n, d;
scanf("%d%d%d", &x, &n, &d);
if (__gcd(x, d) > 1) puts("inf");
else printf("%lld\n", (ll)x * d - x - d + (ll)(x - 2) / n * x + x ? (ll)x * d - x - d + (ll)(x - 2) / n * x + x : -1);
}
return 0;
}