結果
問題 | No.657 テトラナッチ数列 Easy |
ユーザー | polylogK |
提出日時 | 2018-03-02 22:24:24 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 25 ms / 2,000 ms |
コード長 | 806 bytes |
コンパイル時間 | 1,474 ms |
コンパイル使用メモリ | 163,172 KB |
実行使用メモリ | 7,456 KB |
最終ジャッジ日時 | 2023-09-03 22:35:23 |
合計ジャッジ時間 | 2,638 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 8 ms
7,216 KB |
testcase_01 | AC | 8 ms
7,312 KB |
testcase_02 | AC | 8 ms
7,408 KB |
testcase_03 | AC | 8 ms
7,456 KB |
testcase_04 | AC | 9 ms
7,212 KB |
testcase_05 | AC | 22 ms
7,408 KB |
testcase_06 | AC | 8 ms
7,216 KB |
testcase_07 | AC | 8 ms
7,224 KB |
testcase_08 | AC | 8 ms
7,276 KB |
testcase_09 | AC | 24 ms
7,376 KB |
testcase_10 | AC | 23 ms
7,272 KB |
testcase_11 | AC | 24 ms
7,380 KB |
testcase_12 | AC | 25 ms
7,276 KB |
testcase_13 | AC | 25 ms
7,204 KB |
testcase_14 | AC | 25 ms
7,340 KB |
testcase_15 | AC | 25 ms
7,252 KB |
ソースコード
#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; }