結果
| 問題 |
No.1352 Three Coins
|
| コンテスト | |
| ユーザー |
Example0911
|
| 提出日時 | 2021-01-17 14:04:54 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 214 ms / 2,000 ms |
| コード長 | 680 bytes |
| コンパイル時間 | 2,784 ms |
| コンパイル使用メモリ | 194,044 KB |
| 最終ジャッジ日時 | 2025-01-18 00:45:17 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 34 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = (1LL << 61);
ll mod = 998244353;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll A, B, C; cin >> A >> B >> C;
vector<bool>ok(4010 * 4010 + 100);
for (int i = 0; i <= 4010; i++) {
for (int j = 0; j <= 4010; j++) {
ll now = A * i + B * j;
for (int k = now; k <= 4010 * 4010; k += C) {
if (ok[k])break;
ok[k] = true;
}
}
}
int cnt = 0;
for (int i = 1; i <= 4010*4010; i++) {
if (!ok[i]) {
cnt++;
if (i > 2000 * 2000) {
cout << "INF" << endl; return 0;
}
//cout << i << endl;
}
}
cout << cnt << endl;
return 0;
}
Example0911