結果

問題 No.1926 Sequence of Remainders
ユーザー mnmmnm
提出日時 2022-06-05 14:40:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 691 bytes
コンパイル時間 778 ms
コンパイル使用メモリ 78,356 KB
実行使用メモリ 13,276 KB
最終ジャッジ日時 2023-10-21 03:11:13
合計ジャッジ時間 7,506 ms
ジャッジサーバーID
(参考情報)
judge9 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 512 ms
13,276 KB
testcase_01 AC 210 ms
8,860 KB
testcase_02 AC 218 ms
8,860 KB
testcase_03 AC 218 ms
8,860 KB
testcase_04 AC 228 ms
8,860 KB
testcase_05 AC 228 ms
8,860 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
      |          ^

ソースコード

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;
    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;
}
0