結果
| 問題 | No.657 テトラナッチ数列 Easy |
| コンテスト | |
| ユーザー |
shikaku
|
| 提出日時 | 2018-04-25 08:19:00 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 964 bytes |
| 記録 | |
| コンパイル時間 | 526 ms |
| コンパイル使用メモリ | 61,400 KB |
| 実行使用メモリ | 12,800 KB |
| 最終ジャッジ日時 | 2024-06-27 20:57:55 |
| 合計ジャッジ時間 | 11,071 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 TLE * 1 -- * 3 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
int tori( int x ){
vector<int> t(1000000);
if( x == 1 || x == 2 || x == 3 ) return 0;
else if( x == 4 ) return 1;
else if( x > 4 ){
int i;
t.at(1) = 0;
t.at(2) = 0;
t.at(3) = 0;
t.at(4) = 1;
for( i = 5 ; i <= x ; i = i + 1 ){
t.at(i) = ( t.at(i - 1) + t.at(i - 2) + t.at(i - 3) + t.at(i - 4) ) % 17;
}
}
return t.at(x);
}
int main(){
long long q, i;
cin >> q;
vector<long long> n(q);
for( i = 0 ; i < q ; i = i + 1 ){
cin >> n.at(i);
}
for( i = 0 ; i < q ; i = i + 1 ){
cout << tori( n.at(i) ) << endl;
}
return 0;
}
shikaku