結果
| 問題 | No.657 テトラナッチ数列 Easy |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-07 14:01:48 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 530 bytes |
| 記録 | |
| コンパイル時間 | 1,252 ms |
| コンパイル使用メモリ | 160,196 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-30 10:29:27 |
| 合計ジャッジ時間 | 2,779 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 RE * 1 |
| other | AC * 8 RE * 5 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
int memo[10001];
int f(int n) {
if (n <=3)
return 0;
else if (n == 4)
return 1;
else if (memo[n])
return memo[n];
else
return memo[n] = (f(n-1)%17 + f(n-2)%17 + f(n-3)%17 + f(n-4)%17)%17;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int q;
cin >> q;
while (q--) {
int t;
cin >> t;
cout << f(t) << endl;
}
return 0;
}