結果
| 問題 |
No.1350 2019-6problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-24 13:16:33 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 567 bytes |
| コンパイル時間 | 533 ms |
| コンパイル使用メモリ | 66,812 KB |
| 最終ジャッジ日時 | 2025-01-18 07:47:13 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#line 1 "main.cpp"
#include <iostream>
#include <numeric>
using namespace std;
using lint = long long;
constexpr lint INF = 1LL << 61;
void solve() {
lint a, b, k;
cin >> a >> b >> k;
lint ok = INF, ng = 0;
while (ok - ng > 1) {
auto mid = (ok + ng) / 2;
auto cnt = mid / a + mid / b - mid / lcm(a, b);
if (cnt >= k) {
ok = mid;
} else {
ng = mid;
}
}
cout << ok << "\n";
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
solve();
return 0;
}