結果

問題 No.657 テトラナッチ数列 Easy
ユーザー polylogKpolylogK
提出日時 2018-03-02 22:24:24
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 806 bytes
コンパイル時間 2,010 ms
コンパイル使用メモリ 165,692 KB
実行使用メモリ 7,552 KB
最終ジャッジ日時 2024-06-13 03:13:13
合計ジャッジ時間 2,435 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i, a, b) for(int i = (a); i < (b); i++)
#define RREP(i, a, b) for(int i = (a); i >= (b); i--)
#define pq priority_queue
#define P pair<int, int>
#define P2 pair<int, P>
#define P3 pair<int, P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF = 1e9, MOD = 1e9+7, around[] = {0, 1, 1, -1, -1, 0, -1, 1, 0, 0};
const int vx[] = {1, 0, -1, 0}, vy[] = {0, 1, 0, -1};
const ld PI = abs(acos(-1));
const int sqrtN = 512;
const int logN = 32;
const ll LINF=1e18;

int main(){
	int q; cin >> q;
	
	int a[1000010] = {};
	a[0] = a[1] = a[2] = 0; a[3] = 1;
	for(int i = 4; i < 1000010; i++) a[i] = (a[i - 1] + a[i - 2] + a[i - 3] + a[i - 4]) % 17;
	
	for(int i = 0; i < q; i++){
		int k; cin >> k;
		
		cout << a[k - 1] << endl;
	}
		
	return 0;
}
0