結果
| 問題 |
No.1352 Three Coins
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-17 01:55:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 2,000 ms |
| コード長 | 797 bytes |
| コンパイル時間 | 781 ms |
| コンパイル使用メモリ | 91,980 KB |
| 実行使用メモリ | 7,552 KB |
| 最終ジャッジ日時 | 2024-11-09 01:08:53 |
| 合計ジャッジ時間 | 2,307 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 34 |
ソースコード
#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;
}