結果

問題 No.1352 Three Coins
ユーザー 夜
提出日時 2021-03-17 01:55:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 797 bytes
コンパイル時間 709 ms
コンパイル使用メモリ 92,680 KB
実行使用メモリ 7,576 KB
最終ジャッジ日時 2024-04-26 10:34:16
合計ジャッジ時間 2,103 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
7,424 KB
testcase_01 AC 10 ms
7,416 KB
testcase_02 AC 10 ms
7,356 KB
testcase_03 AC 11 ms
7,520 KB
testcase_04 AC 10 ms
7,552 KB
testcase_05 AC 11 ms
7,448 KB
testcase_06 AC 10 ms
7,576 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 11 ms
7,420 KB
testcase_09 AC 10 ms
7,508 KB
testcase_10 AC 10 ms
7,424 KB
testcase_11 AC 10 ms
7,548 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 10 ms
7,452 KB
testcase_14 AC 10 ms
7,552 KB
testcase_15 AC 11 ms
7,424 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 11 ms
7,552 KB
testcase_18 AC 10 ms
7,368 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 11 ms
7,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 11 ms
7,448 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 11 ms
7,548 KB
testcase_28 AC 11 ms
7,552 KB
testcase_29 AC 11 ms
7,520 KB
testcase_30 AC 10 ms
7,552 KB
testcase_31 AC 11 ms
7,424 KB
testcase_32 AC 11 ms
7,416 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 11 ms
7,440 KB
testcase_35 AC 12 ms
7,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
bool bo[4003000] = { false };
long long gcd(long long a, long long b) {
	if (a % b == 0) {
		return (b);
	}
	else {
		return (gcd(b, a % b));
	}
}
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (gcd(a, gcd(b, c)) != 1) {
		cout << "INF" << endl;
		return 0;
	}
	bo[0] = true;
	for (int i = 0; i <= 4000000; i++) {
		if (bo[i]) {
			bo[i + a] = true;
			bo[i + b] = true;
			bo[i + c] = true;
		}
	}
	int co = 0;
	for (int i = 0; i <= 4000000; i++) {
		if (!bo[i]) {
			co++;
		}
	}
	cout << co << endl;
}
0