結果
問題 | No.2526 Kth Not-divisible Number |
ユーザー | maksim |
提出日時 | 2023-11-03 21:23:43 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 505 bytes |
コンパイル時間 | 1,515 ms |
コンパイル使用メモリ | 166,880 KB |
実行使用メモリ | 4,348 KB |
最終ジャッジ日時 | 2023-11-03 21:31:13 |
合計ジャッジ時間 | 15,654 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,348 KB |
testcase_01 | AC | 2 ms
4,348 KB |
testcase_02 | AC | 2 ms
4,348 KB |
testcase_03 | TLE | - |
testcase_04 | TLE | - |
testcase_05 | TLE | - |
testcase_06 | TLE | - |
testcase_07 | TLE | - |
testcase_08 | AC | 675 ms
4,348 KB |
testcase_09 | AC | 529 ms
4,348 KB |
testcase_10 | AC | 856 ms
4,348 KB |
testcase_11 | AC | 746 ms
4,348 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long int f(int a,int b,int x) { return x-x/a-x/b+x/(a*b/__gcd(a,b)); } int32_t main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); int t;cin>>t; while(t--) { int a,b,k;cin>>a>>b>>k; int low=0;int up=8e18; while(up-low>1) { int mid=(low+up)/2; if(f(a,b,mid)>=k) up=mid; else low=mid; } cout<<up<<'\n'; } return 0; }