結果

問題 No.2526 Kth Not-divisible Number
ユーザー DeltaStructDeltaStruct
提出日時 2023-11-03 21:35:48
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 477 ms / 2,000 ms
コード長 259 bytes
コンパイル時間 3,136 ms
コンパイル使用メモリ 245,404 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-11-03 21:35:56
合計ジャッジ時間 7,360 ms
ジャッジサーバーID
(参考情報)
judge14 / 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 AC 309 ms
4,348 KB
testcase_04 AC 312 ms
4,348 KB
testcase_05 AC 324 ms
4,348 KB
testcase_06 AC 314 ms
4,348 KB
testcase_07 AC 314 ms
4,348 KB
testcase_08 AC 321 ms
4,348 KB
testcase_09 AC 477 ms
4,348 KB
testcase_10 AC 301 ms
4,348 KB
testcase_11 AC 197 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
#define int long long
  int q,a,b,c,x,y,z; cin >> q;
  while(q--){
    cin >> a >> b >> c;
    x=0,y=0,z=c;
    while(z/a!=x||z/b!=y) x = z/a,y = z/b,z=(c+x+y)-z/lcm(a,b);
    cout << z << endl;
  }
}
0