結果

問題 No.891 隣接3項間の漸化式
ユーザー seryuseryu
提出日時 2019-10-01 08:46:09
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 611 bytes
コンパイル時間 1,231 ms
コンパイル使用メモリ 74,480 KB
実行使用メモリ 814,776 KB
最終ジャッジ日時 2024-04-14 08:30:24
合計ジャッジ時間 5,369 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 106 ms
40,372 KB
testcase_04 AC 209 ms
77,588 KB
testcase_05 AC 203 ms
81,036 KB
testcase_06 AC 264 ms
105,176 KB
testcase_07 AC 187 ms
74,400 KB
testcase_08 AC 170 ms
67,952 KB
testcase_09 AC 223 ms
89,100 KB
testcase_10 AC 40 ms
17,524 KB
testcase_11 AC 110 ms
44,168 KB
testcase_12 AC 315 ms
124,480 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 194 ms
80,048 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 1 ms
6,940 KB
testcase_19 AC 24 ms
11,392 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 32 ms
14,200 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 RE -
testcase_26 MLE -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <map>
#include <queue>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;
ll mod = 1e9 + 7;

int main()
{
	ll a, b, n;
	cin >> a >> b >> n;
	vector<ll> x(n + 1);
	rep(i, n + 1)
	{
		if (i == 0)x[i] = 0;
		else if (i == 1)x[i] = 1;
		else x[i] = (a * x[i - 1] + b * x[i - 2]) % mod;
	}
	co(x[n]);
	return 0;
}
0