結果

問題 No.1810 RGB Biscuits
ユーザー polylogKpolylogK
提出日時 2021-11-06 20:26:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 450 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 32,384 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-04-25 08:57:34
合計ジャッジ時間 3,772 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,624 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
	# Algorithm

	Naive

	## Time Complexity

	O(NT)
*/

#include <stdio.h>

constexpr int MOD = 1'000'000'007;

int main() {
	int A, B, N; scanf("%d%d%d", &A, &B, &N);

	using i64 = long long;
	while(N--) {
		int T; scanf("%d", &T);

		i64 r = 1, g = 1, b = 0;
		for(int t = 1; t <= T; t++) {
			if(t % 2) {
				(b += r * A + g * B) %= MOD;
			} else {
				g = r;
				r = b;
				b = 0;
			}
		}

		printf("%d\n", (r + g + b) % MOD);
	}
	return 0;
}
0