結果

問題 No.1352 Three Coins
ユーザー Example0911Example0911
提出日時 2021-01-17 14:04:54
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 680 bytes
コンパイル時間 2,188 ms
コンパイル使用メモリ 200,652 KB
実行使用メモリ 5,416 KB
最終ジャッジ日時 2023-08-24 23:05:21
合計ジャッジ時間 8,079 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
4,972 KB
testcase_01 AC 117 ms
4,848 KB
testcase_02 AC 137 ms
4,912 KB
testcase_03 AC 157 ms
4,840 KB
testcase_04 AC 155 ms
4,840 KB
testcase_05 AC 157 ms
4,900 KB
testcase_06 AC 165 ms
4,976 KB
testcase_07 AC 78 ms
4,972 KB
testcase_08 AC 149 ms
4,916 KB
testcase_09 AC 118 ms
4,836 KB
testcase_10 AC 141 ms
4,840 KB
testcase_11 AC 118 ms
4,892 KB
testcase_12 AC 73 ms
4,848 KB
testcase_13 AC 156 ms
4,968 KB
testcase_14 AC 162 ms
4,836 KB
testcase_15 AC 162 ms
4,844 KB
testcase_16 AC 97 ms
5,364 KB
testcase_17 AC 119 ms
4,964 KB
testcase_18 AC 144 ms
5,328 KB
testcase_19 AC 98 ms
4,904 KB
testcase_20 AC 106 ms
4,960 KB
testcase_21 AC 153 ms
4,984 KB
testcase_22 AC 75 ms
5,372 KB
testcase_23 AC 67 ms
4,892 KB
testcase_24 AC 117 ms
5,000 KB
testcase_25 AC 77 ms
4,952 KB
testcase_26 AC 69 ms
4,952 KB
testcase_27 AC 117 ms
4,972 KB
testcase_28 AC 150 ms
4,976 KB
testcase_29 AC 136 ms
4,972 KB
testcase_30 AC 119 ms
4,888 KB
testcase_31 AC 117 ms
4,892 KB
testcase_32 AC 116 ms
4,972 KB
testcase_33 AC 59 ms
4,844 KB
testcase_34 AC 118 ms
4,836 KB
testcase_35 AC 117 ms
5,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

using ll = long long;
using P = pair<ll, ll>;
const ll INF = (1LL << 61);
ll mod = 998244353;
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll A, B, C; cin >> A >> B >> C;
	vector<bool>ok(4010 * 4010 + 100);
	for (int i = 0; i <= 4010; i++) {
		for (int j = 0; j <= 4010; j++) {
			ll now = A * i + B * j;
			for (int k = now; k <= 4010 * 4010; k += C) {
				if (ok[k])break;
				ok[k] = true;
			}
		}
	}
	int cnt = 0;
	for (int i = 1; i <= 4010*4010; i++) {
		if (!ok[i]) {
			cnt++;
			if (i > 2000 * 2000) {
				cout << "INF" << endl; return 0;
			}
			//cout << i << endl;
		}
	}
	cout << cnt << endl;
	return 0;
}
0