結果

問題 No.657 テトラナッチ数列 Easy
ユーザー Pumpkin1e18Pumpkin1e18
提出日時 2018-05-12 23:44:50
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 894 bytes
コンパイル時間 1,609 ms
コンパイル使用メモリ 143,016 KB
実行使用メモリ 11,856 KB
最終ジャッジ日時 2023-09-10 18:34:34
合計ジャッジ時間 2,652 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
11,720 KB
testcase_01 AC 10 ms
11,640 KB
testcase_02 AC 10 ms
11,856 KB
testcase_03 AC 10 ms
11,620 KB
testcase_04 AC 11 ms
11,708 KB
testcase_05 AC 11 ms
11,616 KB
testcase_06 AC 10 ms
11,632 KB
testcase_07 AC 10 ms
11,628 KB
testcase_08 AC 10 ms
11,636 KB
testcase_09 AC 12 ms
11,856 KB
testcase_10 AC 12 ms
11,628 KB
testcase_11 AC 12 ms
11,728 KB
testcase_12 AC 12 ms
11,620 KB
testcase_13 AC 12 ms
11,664 KB
testcase_14 AC 13 ms
11,708 KB
testcase_15 AC 13 ms
11,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;
int mod = 1e9+7;

int a[100000], dp[1000010];
signed main(){
	int n;
	scanf("%lld", &n);
	rep(i,n)scanf("%lld", &a[i]);
	dp[4] = 1;
	repi(i,5,1000000+1){
		dp[i] = dp[i-1]+dp[i-2]+dp[i-3]+dp[i-4];
		dp[i] %= 17;
	}
	rep(i,n)printf("%lld\n", dp[a[i]]);
	return 0;
}


0