結果
問題 | No.657 テトラナッチ数列 Easy |
ユーザー | tnakao0123 |
提出日時 | 2018-03-03 19:33:20 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 858 bytes |
コンパイル時間 | 535 ms |
コンパイル使用メモリ | 81,632 KB |
実行使用メモリ | 7,520 KB |
最終ジャッジ日時 | 2023-09-17 04:46:24 |
合計ジャッジ時間 | 1,927 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 10 ms
7,364 KB |
testcase_01 | AC | 10 ms
7,392 KB |
testcase_02 | AC | 10 ms
7,360 KB |
testcase_03 | AC | 10 ms
7,388 KB |
testcase_04 | AC | 10 ms
7,520 KB |
testcase_05 | AC | 11 ms
7,384 KB |
testcase_06 | AC | 10 ms
7,468 KB |
testcase_07 | AC | 10 ms
7,400 KB |
testcase_08 | AC | 10 ms
7,512 KB |
testcase_09 | AC | 11 ms
7,396 KB |
testcase_10 | AC | 12 ms
7,328 KB |
testcase_11 | AC | 12 ms
7,328 KB |
testcase_12 | AC | 12 ms
7,448 KB |
testcase_13 | AC | 12 ms
7,380 KB |
testcase_14 | AC | 12 ms
7,396 KB |
testcase_15 | AC | 13 ms
7,516 KB |
ソースコード
/* -*- coding: utf-8 -*- * * 657.cc: No.657 テトラナッチ数列 Easy - yukicoder */ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<string> #include<vector> #include<map> #include<set> #include<stack> #include<list> #include<queue> #include<deque> #include<algorithm> #include<numeric> #include<utility> #include<complex> #include<functional> using namespace std; /* constant */ const int MAX_N = 1000000; const int MOD = 17; /* typedef */ /* global variables */ int ts[MAX_N + 1]; /* subroutines */ /* main */ int main() { ts[1] = ts[2] = ts[3] = 0; ts[4] = 1; for (int i = 5; i <= MAX_N; i++) ts[i] = (ts[i - 1] + ts[i - 2] + ts[i - 3] + ts[i - 4]) % MOD; int q; scanf("%d", &q); while (q--) { int n; scanf("%d", &n); printf("%d\n", ts[n]); } return 0; }