結果
問題 | No.2526 Kth Not-divisible Number |
ユーザー | inkyaman |
提出日時 | 2024-03-24 16:06:43 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 892 ms / 2,000 ms |
コード長 | 830 bytes |
コンパイル時間 | 1,252 ms |
コンパイル使用メモリ | 119,204 KB |
実行使用メモリ | 6,676 KB |
最終ジャッジ日時 | 2024-03-24 16:06:53 |
合計ジャッジ時間 | 9,752 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,676 KB |
testcase_01 | AC | 2 ms
6,676 KB |
testcase_02 | AC | 2 ms
6,676 KB |
testcase_03 | AC | 891 ms
6,676 KB |
testcase_04 | AC | 891 ms
6,676 KB |
testcase_05 | AC | 866 ms
6,676 KB |
testcase_06 | AC | 892 ms
6,676 KB |
testcase_07 | AC | 891 ms
6,676 KB |
testcase_08 | AC | 590 ms
6,676 KB |
testcase_09 | AC | 569 ms
6,676 KB |
testcase_10 | AC | 642 ms
6,676 KB |
testcase_11 | AC | 554 ms
6,676 KB |
ソースコード
#define _USE_MATH_DEFINES #include <iostream> #include <string> #include <algorithm> #include <vector> #include <queue> #include <math.h> #include <cmath> #include <stack> #include <map> #include <set> #include <numeric> #include <iomanip> #include <climits> #include <functional> #include <cassert> #include <tuple> using namespace std; using ll = long long; int T; int main() { cin >> T; vector<ll> ans; while(T--) { ll A, B, K; cin >> A >> B >> K; ll l = 0, r = 3e18; while(r-l > 1) { ll mid = l+(r-l)/2; ll t = mid; t -= mid/A; t -= mid/B; t += mid/(A/gcd(A,B)*B); if(t >= K) r = mid; else l = mid; } ans.push_back(r); } for(auto v : ans) cout << v << endl; }