結果

問題 No.657 テトラナッチ数列 Easy
ユーザー 0Kate
提出日時 2018-03-06 20:05:18
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 568 bytes
コンパイル時間 524 ms
コンパイル使用メモリ 60,776 KB
実行使用メモリ 12,480 KB
最終ジャッジ日時 2024-09-21 16:11:59
合計ジャッジ時間 1,509 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 5 WA * 8
権限があれば一括ダウンロードができます

ソースコード

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