結果
問題 |
No.1352 Three Coins
|
ユーザー |
|
提出日時 | 2023-05-07 10:32:51 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 87 ms / 2,000 ms |
コード長 | 720 bytes |
コンパイル時間 | 5,189 ms |
コンパイル使用メモリ | 307,804 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-24 11:41:29 |
合計ジャッジ時間 | 7,785 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; #define ll long long #define rep(i, n) for (int i = 0; i < (n); i++) #define coutf(f) cout << fixed << setprecision(f) #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() int main() { const int X = 10000000; int a, b, c; cin >> a >> b >> c; if (gcd(gcd(a, b), c) != 1) { cout << "INF" << endl; return 0; } vector<bool> ok(X + 1, false); ok[0] = true; int ans = 0; for (int x = 0; x <= X; ++x) { if (ok[x]) { if (x + a <= X) ok[x + a] = true; if (x + b <= X) ok[x + b] = true; if (x + c <= X) ok[x + c] = true; } else { ans++; } } cout << ans << endl; return 0; }