結果

問題 No.1352 Three Coins
ユーザー hiikunZhiikunZ
提出日時 2022-05-15 16:59:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 995 bytes
コンパイル時間 2,185 ms
コンパイル使用メモリ 201,768 KB
実行使用メモリ 65,764 KB
最終ジャッジ日時 2023-10-11 02:29:24
合計ジャッジ時間 6,049 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 9 ms
7,316 KB
testcase_03 AC 31 ms
12,796 KB
testcase_04 AC 41 ms
6,948 KB
testcase_05 AC 56 ms
27,176 KB
testcase_06 AC 41 ms
35,764 KB
testcase_07 AC 5 ms
8,776 KB
testcase_08 AC 42 ms
37,640 KB
testcase_09 AC 5 ms
7,148 KB
testcase_10 AC 16 ms
18,420 KB
testcase_11 AC 5 ms
7,588 KB
testcase_12 AC 3 ms
4,948 KB
testcase_13 AC 30 ms
13,432 KB
testcase_14 AC 37 ms
33,500 KB
testcase_15 AC 54 ms
16,632 KB
testcase_16 AC 59 ms
32,312 KB
testcase_17 AC 4 ms
4,880 KB
testcase_18 AC 12 ms
13,808 KB
testcase_19 AC 16 ms
22,248 KB
testcase_20 AC 36 ms
24,544 KB
testcase_21 AC 81 ms
50,340 KB
testcase_22 AC 6 ms
4,352 KB
testcase_23 AC 4 ms
5,684 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 38 ms
17,156 KB
testcase_27 AC 2 ms
4,356 KB
testcase_28 AC 70 ms
46,812 KB
testcase_29 AC 47 ms
4,476 KB
testcase_30 AC 76 ms
65,408 KB
testcase_31 AC 3 ms
4,352 KB
testcase_32 AC 76 ms
65,544 KB
testcase_33 AC 64 ms
65,764 KB
testcase_34 AC 2 ms
4,348 KB
testcase_35 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
//#include<atcoder/all>
//using namespace atcoder;
using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
constexpr ll MAX = 2000000000000000000;
constexpr ld PI = 3.14159265358979;
constexpr ll MOD = 0;//2024948111;
ld dotorad(ld K){return PI * K / 180.0;}
ld radtodo(ld K){return K * 180.0 / PI;}
mt19937 mt;
void randinit(){srand((unsigned)time(NULL));mt = mt19937(rand());}
int main(){
    ll A,B,C;
    cin >> A >> B >> C;
    vector<ll> P((A + B + 1) * C + 1,0),Q(C,0);
    for(ll i = 0;i <= C;i++){
        for(ll j = 0;j <= C;j++){
            P[A * i + B * j] = 1;
            Q[(A * i + B * j) % C] = 1;
        }
    }
    for(ll i = 0;i < C;i++){
        if(Q[i] == 0){
            cout << "INF" << endl;
            return 0;
        }
    }
    ll ans = 0;
    for(ll i = 0;i <= (A + B) * C;i++){
        if(P[i]){
            P[i + C] = 1;
        }
        else ans++;
    }
    cout << ans << endl;
}
0