結果

問題 No.1352 Three Coins
ユーザー pockynypockyny
提出日時 2021-01-17 13:31:21
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,026 ms / 2,000 ms
コード長 591 bytes
コンパイル時間 622 ms
コンパイル使用メモリ 72,208 KB
実行使用メモリ 5,068 KB
最終ジャッジ日時 2023-08-24 23:04:38
合計ジャッジ時間 27,239 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,016 ms
4,816 KB
testcase_01 AC 1,020 ms
4,880 KB
testcase_02 AC 936 ms
4,904 KB
testcase_03 AC 930 ms
4,732 KB
testcase_04 AC 950 ms
4,820 KB
testcase_05 AC 908 ms
4,732 KB
testcase_06 AC 862 ms
4,848 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 873 ms
4,884 KB
testcase_09 AC 947 ms
4,824 KB
testcase_10 AC 899 ms
4,712 KB
testcase_11 AC 929 ms
5,068 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 917 ms
4,732 KB
testcase_14 AC 877 ms
4,852 KB
testcase_15 AC 916 ms
4,836 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 982 ms
4,732 KB
testcase_18 AC 926 ms
4,796 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 848 ms
4,724 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 1,005 ms
4,880 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1,023 ms
4,908 KB
testcase_28 AC 837 ms
4,712 KB
testcase_29 AC 948 ms
4,848 KB
testcase_30 AC 821 ms
4,908 KB
testcase_31 AC 981 ms
4,912 KB
testcase_32 AC 807 ms
4,904 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 1,020 ms
4,828 KB
testcase_35 AC 1,026 ms
4,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <bitset>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){
    if(a<b) swap(a,b);
    if(b==0) return a;
    return gcd(a%b,b);
}

bitset<4000000> bs;
int main(){
    int i,a,b,c; cin >> a >> b >> c;
    int s = gcd(a,b);
    s = gcd(s,c);
    if(s!=1){
        cout << "INF" << endl;
        return 0;
    }
    bs[0] = 1;
    for(i=0;i<2000;i++) bs |= (bs<<i*a);
    for(i=0;i<2000;i++) bs |= (bs<<i*b);
    for(i=0;i<2000;i++) bs |= (bs<<i*c);
    int cnt = 0;
    for(i=0;i<4000000;i++){
        if(!bs[i]) cnt++;
    }
    cout << cnt << endl;
}
0