結果
問題 | No.2526 Kth Not-divisible Number |
ユーザー | 沙耶花 |
提出日時 | 2023-11-03 21:27:42 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 825 ms / 2,000 ms |
コード長 | 587 bytes |
コンパイル時間 | 5,035 ms |
コンパイル使用メモリ | 262,664 KB |
実行使用メモリ | 4,348 KB |
最終ジャッジ日時 | 2023-11-03 21:28:05 |
合計ジャッジ時間 | 12,089 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
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 | AC | 824 ms
4,348 KB |
testcase_04 | AC | 788 ms
4,348 KB |
testcase_05 | AC | 818 ms
4,348 KB |
testcase_06 | AC | 825 ms
4,348 KB |
testcase_07 | AC | 786 ms
4,348 KB |
testcase_08 | AC | 597 ms
4,348 KB |
testcase_09 | AC | 506 ms
4,348 KB |
testcase_10 | AC | 683 ms
4,348 KB |
testcase_11 | AC | 261 ms
4,348 KB |
ソースコード
#include <stdio.h> #include <bits/stdc++.h> #include <atcoder/all> using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000001 int main(){ int _t; cin>>_t; rep(_,_t){ long long a,b,k; cin>>a>>b>>k; long long ok = 0,ng = k*3 + k + k + k; while(ng-ok>1LL){ long long mid = (ok+ng)/2; long long t = mid/a; t += mid/b; t -= mid/lcm(a,b); t = mid-t; if(t<=k-1)ok = mid; else ng = mid; } cout<<ok+1<<endl; } return 0; }