結果

問題 No.657 テトラナッチ数列 Easy
ユーザー aim_cpoaim_cpo
提出日時 2018-03-02 22:29:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 850 bytes
コンパイル時間 2,047 ms
コンパイル使用メモリ 164,068 KB
実行使用メモリ 11,340 KB
最終ジャッジ日時 2023-09-03 23:01:32
合計ジャッジ時間 2,626 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
11,132 KB
testcase_01 AC 9 ms
11,340 KB
testcase_02 AC 8 ms
11,184 KB
testcase_03 AC 8 ms
11,196 KB
testcase_04 AC 8 ms
11,132 KB
testcase_05 AC 20 ms
11,196 KB
testcase_06 AC 8 ms
11,192 KB
testcase_07 AC 9 ms
11,200 KB
testcase_08 AC 8 ms
11,188 KB
testcase_09 AC 21 ms
11,228 KB
testcase_10 AC 21 ms
11,144 KB
testcase_11 AC 23 ms
11,144 KB
testcase_12 AC 23 ms
11,300 KB
testcase_13 AC 23 ms
11,132 KB
testcase_14 AC 22 ms
11,140 KB
testcase_15 AC 22 ms
11,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define show(x) cerr<<#x<<"="<<x<<"\n"
using namespace std;

int n,m;
string s;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout<<fixed;
#ifdef LOCAL_DEFINE
    FILE *stream1;
    //FILE *stream2;
    stream1=freopen("in","r",stdin);
    //stream2=freopen("out","w",stdout);
    if(stream1==NULL)return 0;
    //if(stream2==NULL)return 0;
#endif
    cin>>n;
    ll a[1000001];
    a[0]=0,a[1]=0,a[2]=0,a[3]=1;
    for(int i=4;i<1000001;i++){
      a[i]=(a[i-1]+a[i-2]+a[i-3]+a[i-4])%17;
    }
    for(int i=0;i<n;i++){
      int b;cin>>b;
      cout<<a[b-1]%17<<endl;
    }
#ifdef LOCAL_DEFINE
    cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
    fclose(stream1);
    //fclose(stream2);
#endif
    return 0;
}
0