結果

問題 No.657 テトラナッチ数列 Easy
ユーザー focusfocus
提出日時 2018-03-05 15:43:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 476 bytes
コンパイル時間 558 ms
コンパイル使用メモリ 73,444 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-28 21:51:42
合計ジャッジ時間 1,720 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
権限があれば一括ダウンロードができます

ソースコード

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);
    return memo[n] % 17;
}

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