結果

問題 No.657 テトラナッチ数列 Easy
ユーザー ahe100ahe100
提出日時 2018-06-06 21:52:14
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 745 bytes
コンパイル時間 701 ms
コンパイル使用メモリ 71,892 KB
実行使用メモリ 11,380 KB
最終ジャッジ日時 2023-09-12 22:52:51
合計ジャッジ時間 2,090 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
11,236 KB
testcase_01 AC 22 ms
11,208 KB
testcase_02 AC 22 ms
11,264 KB
testcase_03 AC 21 ms
11,308 KB
testcase_04 AC 22 ms
11,236 KB
testcase_05 AC 35 ms
11,244 KB
testcase_06 AC 21 ms
11,312 KB
testcase_07 AC 22 ms
11,164 KB
testcase_08 AC 21 ms
11,176 KB
testcase_09 AC 37 ms
11,380 KB
testcase_10 AC 37 ms
11,236 KB
testcase_11 AC 38 ms
11,256 KB
testcase_12 AC 38 ms
11,304 KB
testcase_13 AC 39 ms
11,272 KB
testcase_14 AC 38 ms
11,244 KB
testcase_15 AC 39 ms
11,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll mod = 17;
ll inf = 1e18;

//WA

int main(void){
	ll Q,n[10010],t[1000010];
	t[1]=0;
	t[2]=0;
	t[3]=0;
	t[4]=1;
	reg(i,5,1000000)t[i]=(t[i-1]+t[i-2]+t[i-3]+t[i-4])%mod;
	cin>>Q;
	rep(i,Q)cin>>n[i];
	rep(i,Q)cout<<t[n[i]]<<endl;;
}
0