結果
| 問題 | No.894 二種類のバス |
| コンテスト | |
| ユーザー |
noisy_noimin
|
| 提出日時 | 2019-09-27 21:34:58 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 1,000 ms |
| + 484µs | |
| コード長 | 764 bytes |
| 記録 | |
| コンパイル時間 | 5,110 ms |
| コンパイル使用メモリ | 423,352 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-09-03 11:56:08 |
| 合計ジャッジ時間 | 6,629 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
namespace mp = boost::multiprecision;
using ll = long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
{ 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};
mp::cpp_int gcd(mp::cpp_int a, mp::cpp_int b){
if(b == 0) return a;
else return gcd(b, a%b);
}
mp::cpp_int lcm(mp::cpp_int a, mp::cpp_int b) {
return a / gcd(a, b) * b;
}
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
mp::cpp_int t, a, b;
cin >> t >> a >> b;
mp::cpp_int l = lcm(a, b);
mp::cpp_int ans = ((t-1)/a+1) + ((t-1)/b+1) - ((t-1)/l+1);
cout << ans << endl;
}
noisy_noimin