結果
| 問題 |
No.2526 Kth Not-divisible Number
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-03 21:23:43 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 505 bytes |
| コンパイル時間 | 1,716 ms |
| コンパイル使用メモリ | 165,760 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-25 19:20:55 |
| 合計ジャッジ時間 | 16,169 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 6 TLE * 5 |
ソースコード
#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;
}