結果

問題 No.657 テトラナッチ数列 Easy
ユーザー SotaUNSotaUN
提出日時 2020-11-02 22:02:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 564 bytes
コンパイル時間 712 ms
コンパイル使用メモリ 91,392 KB
実行使用メモリ 10,824 KB
最終ジャッジ日時 2023-09-29 13:50:51
合計ジャッジ時間 1,709 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
10,548 KB
testcase_01 AC 7 ms
10,616 KB
testcase_02 AC 7 ms
10,756 KB
testcase_03 AC 8 ms
10,760 KB
testcase_04 AC 7 ms
10,824 KB
testcase_05 AC 19 ms
10,644 KB
testcase_06 AC 9 ms
10,500 KB
testcase_07 AC 7 ms
10,764 KB
testcase_08 AC 6 ms
10,544 KB
testcase_09 AC 19 ms
10,512 KB
testcase_10 AC 20 ms
10,648 KB
testcase_11 AC 20 ms
10,560 KB
testcase_12 AC 20 ms
10,644 KB
testcase_13 AC 22 ms
10,684 KB
testcase_14 AC 21 ms
10,696 KB
testcase_15 AC 21 ms
10,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
    vector<ll> dp(1000000);
    dp[0] = 0,dp[1] = 0,dp[2] = 0,dp[3] = 1;
    for(int i = 4;i < 1000000;i++){
        dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3] + dp[i - 4];
        dp[i] %= 17;
    }
    ll q;
    cin >> q;
    for(int i = 0;i < q;i++){
        ll in;
        cin >> in;
        cout << dp[in - 1] << endl;
    }
}
0