結果

問題 No.1926 Sequence of Remainders
ユーザー mnmmnm
提出日時 2022-06-05 14:52:59
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 272 ms / 2,000 ms
コード長 611 bytes
コンパイル時間 643 ms
コンパイル使用メモリ 77,876 KB
実行使用メモリ 8,832 KB
最終ジャッジ日時 2024-09-21 04:10:06
合計ジャッジ時間 11,694 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

#define rep(i,n) for(i=0; i<n; ++i)
#define in(a) cin >> a
#define out(a,b) cout << a << b
using namespace std;
using lint = long long;

lint an(int n, int k, int m){
    lint x=k%m;
    if(x<m-n);
    else    x=0;

    return x;
}

int main(void){
    int i, j, n, m, k, cnt = 0, t;
    in(t);
    vector<vector<int>> x(t, vector<int>(3));
    rep(i,t){
        rep(j,3){
            in(n);
            x[i][j]=n;
        }
    }
    rep(i,t){
        out(an(x[i][0],x[i][2],x[i][1]),endl);
    }

    return 0;
}

0