結果

問題 No.1926 Sequence of Remainders
ユーザー mkmkmkmkmkmkmkmk
提出日時 2022-05-06 21:30:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 257 ms / 2,000 ms
コード長 2,302 bytes
コンパイル時間 5,010 ms
コンパイル使用メモリ 260,728 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-20 02:23:37
合計ジャッジ時間 16,332 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 185 ms
4,380 KB
testcase_02 AC 183 ms
4,376 KB
testcase_03 AC 184 ms
4,380 KB
testcase_04 AC 187 ms
4,376 KB
testcase_05 AC 188 ms
4,380 KB
testcase_06 AC 251 ms
4,380 KB
testcase_07 AC 251 ms
4,376 KB
testcase_08 AC 252 ms
4,376 KB
testcase_09 AC 251 ms
4,380 KB
testcase_10 AC 251 ms
4,380 KB
testcase_11 AC 254 ms
4,380 KB
testcase_12 AC 256 ms
4,380 KB
testcase_13 AC 251 ms
4,376 KB
testcase_14 AC 255 ms
4,380 KB
testcase_15 AC 250 ms
4,376 KB
testcase_16 AC 250 ms
4,376 KB
testcase_17 AC 250 ms
4,380 KB
testcase_18 AC 251 ms
4,380 KB
testcase_19 AC 252 ms
4,376 KB
testcase_20 AC 249 ms
4,376 KB
testcase_21 AC 253 ms
4,380 KB
testcase_22 AC 251 ms
4,376 KB
testcase_23 AC 251 ms
4,376 KB
testcase_24 AC 252 ms
4,380 KB
testcase_25 AC 255 ms
4,376 KB
testcase_26 AC 256 ms
4,376 KB
testcase_27 AC 252 ms
4,376 KB
testcase_28 AC 257 ms
4,376 KB
testcase_29 AC 255 ms
4,376 KB
testcase_30 AC 257 ms
4,376 KB
testcase_31 AC 256 ms
4,376 KB
testcase_32 AC 254 ms
4,376 KB
testcase_33 AC 252 ms
4,376 KB
testcase_34 AC 254 ms
4,380 KB
testcase_35 AC 253 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
//using mint = modint1000000007;
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint i=0;i<n;i++)
#define repp(i,m,n) for(lint i=m;i<n;i++)
#define repm(i,n) for(lint i=n-1;i>=0;i--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
//const lint MOD =1000000007;
const lint MOD=998244353;
const lint MAX = 4000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
#pragma GCC optimize("Ofast")
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)

 
 
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    }

    lint popcount(lint n){
        lint ret=0;
        while(n!=0){
            if(n%2)ret++;
            n/=2;
        }
        return ret;
    }

    int main(){
        lint t;
        cin>>t;
        while(t--){
            lint n,m,k;
            cin>>n>>m>>k;
            lint g=k%m;
            if(m-n>g)cout<<g<<endl;
            else cout<<0<<endl;
        }

    }

         
         
         
         
        




        
        
        

    


       
       
       
       

       

    

        


        
        



    
0