結果
| 問題 | 
                            No.1926 Sequence of Remainders
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-06-05 14:21:07 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 559 bytes | 
| コンパイル時間 | 543 ms | 
| コンパイル使用メモリ | 73,396 KB | 
| 実行使用メモリ | 13,884 KB | 
| 最終ジャッジ日時 | 2024-09-21 04:09:35 | 
| 合計ジャッジ時間 | 10,027 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 5 TLE * 1 -- * 29 | 
コンパイルメッセージ
main.cpp: In function 'lint an(int, int, int)':
main.cpp:19:12: warning: 'x' may be used uninitialized [-Wmaybe-uninitialized]
   19 |     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:29: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);
    }
    return x;
}
int main(void){
    int i, j, n, m, k, cnt = 0, t;
    in(t);
    rep(i,t){
        in(n);
        in(m);
        in(k);
        out(an(n,k,m),endl);
    }
    
    return 0;
}