結果

問題 No.657 テトラナッチ数列 Easy
ユーザー sggkshiosggkshio
提出日時 2018-12-26 01:14:27
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 696 bytes
コンパイル時間 689 ms
コンパイル使用メモリ 82,556 KB
実行使用メモリ 11,316 KB
最終ジャッジ日時 2024-04-09 02:50:08
合計ジャッジ時間 1,734 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
11,168 KB
testcase_01 AC 10 ms
11,156 KB
testcase_02 AC 9 ms
11,260 KB
testcase_03 AC 9 ms
11,120 KB
testcase_04 AC 11 ms
11,096 KB
testcase_05 AC 24 ms
11,240 KB
testcase_06 AC 11 ms
11,140 KB
testcase_07 AC 10 ms
11,256 KB
testcase_08 AC 11 ms
11,128 KB
testcase_09 AC 28 ms
11,128 KB
testcase_10 AC 26 ms
11,236 KB
testcase_11 AC 26 ms
11,020 KB
testcase_12 AC 27 ms
11,148 KB
testcase_13 AC 27 ms
11,164 KB
testcase_14 AC 26 ms
11,292 KB
testcase_15 AC 27 ms
11,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>
using namespace std;

//#include<bits/stdc++.h>
long long int t[1000005];
int main() {
	t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 1;
	for (int i = 5; i <= 1000000; i++) {
		t[i] = t[i - 1] + t[i - 2] + t[i - 3] + t[i - 4];
		t[i] %= 17;
	}

	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int q;
		cin >> q;
		cout << t[q]  << endl;
	}
	

	return 0;
}
0