結果

問題 No.657 テトラナッチ数列 Easy
ユーザー focus
提出日時 2018-03-05 15:44:47
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 476 bytes
コンパイル時間 875 ms
コンパイル使用メモリ 73,556 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-21 16:40:28
合計ジャッジ時間 1,321 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 3 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<bitset>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std;
#define ll long long
ll memo[100000]={};
ll tetora(ll n){
    if(n<4)    return 0;
    else if(n==4)   return 1;
    if(memo[n]) memo[n] = (tetora(n-1)+tetora(n-2)+tetora(n-3)+tetora(n-4))%17;
    return memo[n];
}

int main(){
    ll Q,num;
    cin >> Q;
    while(Q--){
        cin >> num;
        cout << tetora(Q) << endl;
    }
    return 0;
}
0