結果
| 問題 | No.1352 Three Coins |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-17 13:19:29 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 476 ms / 2,000 ms |
| コード長 | 477 bytes |
| コンパイル時間 | 647 ms |
| コンパイル使用メモリ | 71,688 KB |
| 実行使用メモリ | 40,228 KB |
| 最終ジャッジ日時 | 2024-12-23 09:30:34 |
| 合計ジャッジ時間 | 11,420 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 34 |
コンパイルメッセージ
main.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
9 | main()
| ^~~~
ソースコード
#include<iostream>
#include<algorithm>
#include<bitset>
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int L=1e8;
bitset<L>dp;
long A,B,C;
main()
{
cin>>A>>B>>C;
if(A>B)swap(A,B);
if(B>C)swap(B,C);
if(A>B)swap(A,B);
int g=gcd(A,gcd(B,C));
if(g>1)
{
cout<<"INF"<<endl;
return 0;
}
dp[0]=1;
for(int i=0;A<<i<L;i++)dp|=dp<<(A<<i);
for(int i=0;B<<i<L;i++)dp|=dp<<(B<<i);
for(int i=0;C<<i<L;i++)dp|=dp<<(C<<i);
cout<<(~dp).count()<<endl;
}