結果

問題 No.1352 Three Coins
ユーザー kotatsugamekotatsugame
提出日時 2021-01-17 13:19:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 560 ms / 2,000 ms
コード長 477 bytes
コンパイル時間 656 ms
コンパイル使用メモリ 70,360 KB
実行使用メモリ 40,244 KB
最終ジャッジ日時 2023-08-24 23:02:22
合計ジャッジ時間 13,438 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 560 ms
39,972 KB
testcase_01 AC 486 ms
39,896 KB
testcase_02 AC 410 ms
39,980 KB
testcase_03 AC 418 ms
39,980 KB
testcase_04 AC 435 ms
40,244 KB
testcase_05 AC 391 ms
39,980 KB
testcase_06 AC 377 ms
39,900 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 381 ms
39,976 KB
testcase_09 AC 402 ms
39,892 KB
testcase_10 AC 382 ms
40,064 KB
testcase_11 AC 389 ms
40,044 KB
testcase_12 AC 1 ms
4,384 KB
testcase_13 AC 390 ms
40,036 KB
testcase_14 AC 385 ms
39,980 KB
testcase_15 AC 388 ms
39,876 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 402 ms
39,896 KB
testcase_18 AC 384 ms
40,244 KB
testcase_19 AC 2 ms
4,384 KB
testcase_20 AC 2 ms
4,384 KB
testcase_21 AC 355 ms
39,972 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,384 KB
testcase_24 AC 445 ms
39,872 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 501 ms
40,064 KB
testcase_28 AC 402 ms
40,008 KB
testcase_29 AC 410 ms
39,872 KB
testcase_30 AC 357 ms
40,096 KB
testcase_31 AC 369 ms
39,896 KB
testcase_32 AC 328 ms
39,984 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 465 ms
40,232 KB
testcase_35 AC 493 ms
39,872 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:9:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    9 | main()
      | ^~~~

ソースコード

diff #

#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;
}
0