結果

問題 No.2066 Simple Math !
ユーザー k1suxuk1suxu
提出日時 2022-09-02 23:36:07
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,738 bytes
コンパイル時間 4,268 ms
コンパイル使用メモリ 309,264 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-27 23:12:28
合計ジャッジ時間 8,606 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 171 ms
6,940 KB
testcase_15 AC 165 ms
6,940 KB
testcase_16 AC 167 ms
6,940 KB
testcase_17 AC 164 ms
6,940 KB
testcase_18 AC 171 ms
6,940 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 AC 131 ms
6,940 KB
testcase_25 AC 122 ms
6,944 KB
testcase_26 AC 144 ms
6,940 KB
testcase_27 AC 130 ms
6,944 KB
testcase_28 AC 126 ms
6,944 KB
testcase_29 AC 46 ms
6,940 KB
testcase_30 WA -
testcase_31 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define rep(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i = (int)a; i < (int)b; i++)
#define all(x) x.begin(),x.end()
//#define mp make_pair
#define vi vector<int>
#define vvi vector<vi>
#define vll vector<ll>
#define vvll vector<vll>
#define vs vector<string>
#define vvs vector<vs>
#define vc vector<char>
#define vvc vector<vc>
#define pii pair<int,int>
#define pllll pair<ll,ll>
#define vpii vector<pair<int,int>>
#define vpllll vector<pair<ll,ll>>
#define vpis vector<pair<int,string>>
#define vplls vector<pair<ll, string>>
#define vpsi vector<pair<string, int>>
#define vpsll vector<pair<string, ll>>

template<typename T>
void chmax(T &a, const T &b) {a = (a > b? a : b);}
template<typename T>
void chmin(T &a, const T &b) {a = (a < b? a : b);}

using ll = long long;
using ld = long double;
using ull = unsigned long long;

const ll INF = numeric_limits<long long>::max() / 2;
const ld pi = 3.1415926535897932384626433832795028;
const ll mod = 1e9 + 7;
int dx[] = {-1, 0, 1, 0, -1, -1, 1, 1};
int dy[] = {0, -1, 0, 1, -1, 1, -1, 1};

// #define int long long
#include"atcoder/all"

void solve() {
    int t;
    cin >> t;
    while(t--) {
        ll p, q, k;
        cin >> p >> q >> k;

        ll left = 0, right = q*k+1;

        while(right - left > 1) {
            ll mid = (left + right) / 2;
            ll t = (mid+q-1);
            ll now = atcoder::floor_sum((t-t%p)/p+1, q, p, t%p);

            if(now-1 >= k) right = mid;
            else left = mid;
        }

        cout << left << endl;
    }
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}
0