結果

問題 No.657 テトラナッチ数列 Easy
ユーザー 0Kate0Kate
提出日時 2018-03-06 20:05:18
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 568 bytes
コンパイル時間 525 ms
コンパイル使用メモリ 61,936 KB
実行使用メモリ 11,688 KB
最終ジャッジ日時 2023-10-21 14:57:49
合計ジャッジ時間 1,551 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 WA -
testcase_05 AC 15 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

typedef long long ll;

using namespace std;

int main() {
	int q;
	cin >> q;

	int n;
	vector<ll> tetoranatch;

	for(int i = 0; i < 4; i++) {
		tetoranatch.push_back(0);
	}
	tetoranatch.push_back(1);

	for(int i = 0; i < q; i++) {
		cin >> n;

		if(tetoranatch.size() - 1 < n) {
			while(tetoranatch.size() - 1 < n) {
				ll tmp = 0;
				for(int j = 1; j <= 4; j++) {
					tmp += tetoranatch.at(tetoranatch.size() - j);
				}
				tetoranatch.push_back(tmp);
			}
		}

		cout << tetoranatch.at(n) % 17 <<  endl;
	}

	return 0;
}

0