結果

問題 No.657 テトラナッチ数列 Easy
ユーザー 0Kate0Kate
提出日時 2018-03-06 19:27:26
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 545 bytes
コンパイル時間 570 ms
コンパイル使用メモリ 61,740 KB
実行使用メモリ 7,584 KB
最終ジャッジ日時 2023-10-21 13:57:25
合計ジャッジ時間 1,979 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 17 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>

using namespace std;

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

	int n;
	vector<int> 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) {
				int 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