結果
問題 |
No.1352 Three Coins
|
ユーザー |
|
提出日時 | 2021-01-17 14:56:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 963 bytes |
コンパイル時間 | 1,807 ms |
コンパイル使用メモリ | 195,524 KB |
最終ジャッジ日時 | 2025-01-18 01:00:40 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 WA * 2 |
ソースコード
//#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned long long ull; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll myRand(ll B) { return (ull)rng() % B; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int a,b,c; cin >> a >> b >> c; if(__gcd(a,b)!=1 and __gcd(b,c)!=1 and __gcd(c,a)!=1){ printf("INF\n"); } else{ const int N=10000000; vector<bool> dp(N,false); dp[a]=true; dp[b]=true; dp[c]=true; int res=0; for(int i=1;i<N;i++){ if(!dp[i]){ res++; continue; } if(i+a<N){ dp[i+a]=true; } if(i+b<N){ dp[i+b]=true; } if(i+c<N){ dp[i+c]=true; } } printf("%d\n",res); } }