結果
| 問題 | 
                            No.1926 Sequence of Remainders
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-06-05 14:40:41 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 691 bytes | 
| コンパイル時間 | 612 ms | 
| コンパイル使用メモリ | 78,396 KB | 
| 実行使用メモリ | 15,748 KB | 
| 最終ジャッジ日時 | 2024-09-21 04:09:43 | 
| 合計ジャッジ時間 | 7,080 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 5 TLE * 1 -- * 29 | 
コンパイルメッセージ
main.cpp: In function 'lint an(int, int, int)':
main.cpp:20:12: warning: 'x' may be used uninitialized [-Wmaybe-uninitialized]
   20 |     return x;
      |            ^
main.cpp:14:10: note: 'x' was declared here
   14 |     lint x;
      |          ^
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/iostream:39,
                 from main.cpp:1:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
    inlined from 'int main()' at main.cpp:34:9:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:202:25: warning: 'x' may be used uninitialized [-Wmaybe-uninitialized]
  202 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:14:10: note: 'x' was declared here
   14 |     lint x;
      |          ^
            
            ソースコード
#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;
    for(int i=0; i<n+1; ++i){
        if(i==0)    x=k%m;
        else    x=x%(m-i);
        if(x<m-n)    break;
    }
    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;
}