結果
問題 |
No.2526 Kth Not-divisible Number
|
ユーザー |
|
提出日時 | 2023-11-03 22:49:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 319 bytes |
コンパイル時間 | 1,983 ms |
コンパイル使用メモリ | 192,508 KB |
最終ジャッジ日時 | 2025-02-17 18:39:41 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 6 WA * 5 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; void solve(){ ll A,B,K; cin>>A>>B>>K; ll G=A/gcd(A,B)*B,L=0,R=4e18; while(R-L>1){ ll M=(R+L)/2,a=(M/A)+(M/B)-(M/G); (M-a<=K?L:R)=M; } cout<<L<<endl; } int main() { ll T; cin>>T; while(T--)solve(); }