結果
| 問題 |
No.657 テトラナッチ数列 Easy
|
| ユーザー |
kobaryo222
|
| 提出日時 | 2018-03-02 22:30:22 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 2,000 ms |
| コード長 | 1,145 bytes |
| コンパイル時間 | 2,036 ms |
| コンパイル使用メモリ | 82,112 KB |
| 実行使用メモリ | 7,440 KB |
| 最終ジャッジ日時 | 2024-06-13 03:41:42 |
| 合計ジャッジ時間 | 2,017 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1000010000;
static const int MOD = 1000000007;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
int a[1000010];
int main(){
int q;
cin >> q;
REP(i, 1000010){
if(i < 3) a[i] = 0;
else if(i == 3) a[i] = 1;
else a[i] = (a[i - 1] + a[i - 2] + a[i - 3] + a[i - 4]) % 17;
}
REP(i, q){
int tmp;
cin >> tmp;
cout << a[tmp - 1] << endl;
}
return 0;
}
kobaryo222