結果
問題 |
No.657 テトラナッチ数列 Easy
|
ユーザー |
|
提出日時 | 2018-06-07 14:00:39 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 458 bytes |
コンパイル時間 | 1,538 ms |
コンパイル使用メモリ | 158,844 KB |
実行使用メモリ | 38,812 KB |
最終ジャッジ日時 | 2024-06-30 10:29:33 |
合計ジャッジ時間 | 4,672 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 4 TLE * 1 -- * 8 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef pair<int, int> pii; typedef long long int ll; int f(int n) { if (n <=3) return 0; else if (n == 4) return 1; else return (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; }