結果
問題 | No.657 テトラナッチ数列 Easy |
ユーザー |
![]() |
提出日時 | 2018-03-03 11:37:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 896 bytes |
コンパイル時間 | 1,658 ms |
コンパイル使用メモリ | 166,188 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-23 20:36:18 |
合計ジャッジ時間 | 3,352 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 RE * 1 |
other | AC * 5 WA * 3 RE * 5 |
ソースコード
#include <bits/stdc++.h> #define pout(n) printf ("%d\n", n) #define rep(i,a,n) for (int i = a;i < n;i++) #define per(i,n,a) for (int i = n-1;i >= a;i--) #define BIT(bit,a,n) for (int bit = a;bit < (1<<n);bit++) // {0, 1, ..., n-1} の部分集合の全探索 // n番目のフラグが立っている状態は (1<<n) const int d4x[4] = {1, 0, -1, 0}; const int d4y[4] = {0, 1, 0, -1}; const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 }; const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 }; #define MAX_N (int)2e5+20 typedef long long ll; using namespace std; int q; int main(){ scanf("%d",&q); ll t[q]; t[0] = 0; t[1] = 0; t[2] = 0; t[3] = 1; for(ll i = 4; i > 1000000; i++){ t[i] = (t[i-1]+t[i-2]+t[i-3]+t[i-4])%17; } int a[q]; for(ll i = 0; i < q; i++){ cin >> a[i]; } for(ll i = 0; i < q; i++){ printf("%lld\n",t[a[i]-1]); } }