結果

問題 No.1926 Sequence of Remainders
ユーザー SotaSota
提出日時 2022-05-06 21:41:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 507 bytes
コンパイル時間 1,268 ms
コンパイル使用メモリ 70,544 KB
実行使用メモリ 814,544 KB
最終ジャッジ日時 2023-09-20 02:34:01
合計ジャッジ時間 5,452 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 169 ms
204,356 KB
testcase_01 AC 187 ms
4,380 KB
testcase_02 AC 190 ms
4,380 KB
testcase_03 AC 200 ms
4,384 KB
testcase_04 AC 193 ms
4,380 KB
testcase_05 AC 203 ms
4,380 KB
testcase_06 MLE -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>		//cin, cout
#include <vector>		//vector
#include <algorithm>	//sort,min,max,count

using namespace std;

int main() {

	int T, N, M, K;
	cin >> T;

	for (int i = 0; i < T; i++) {
		cin >> N >> M >> K;

		vector<int> a(N + 1);
		a[0] = K % M;
		for (int j = 1; j <= N; j++) {
			if ((M - j) > a[j - 1]) {
				a[j] = a[j - 1];
			}
			else if ((M - j) == a[j - 1]) {
				a[N] = 0;
				break;
			}
			else {
				a[j] = a[j - 1] % (M - j);
			}
		}
		cout << a[N] << endl;
	}

	return 0;

}
0