結果
| 問題 |
No.657 テトラナッチ数列 Easy
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-04 15:28:17 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 13 ms / 2,000 ms |
| コード長 | 550 bytes |
| コンパイル時間 | 1,583 ms |
| コンパイル使用メモリ | 157,544 KB |
| 実行使用メモリ | 7,296 KB |
| 最終ジャッジ日時 | 2024-06-28 01:06:15 |
| 合計ジャッジ時間 | 2,659 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
#include "bits/stdc++.h"
#define fastcin {\
cin.tie(0);\
ios::sync_with_stdio(false);\
}
using namespace std;
int main() {
fastcin;
int q;
cin >> q;
int ta[1000001];
ta[1] = ta[2] = ta[3] = 0, ta[4] = 1;
int max = 4;
for(int i = 0; i < q; i++) {
int n;
cin >> n;
if(n > max) {
for(int j = max+1; j < n+1; j++) {
ta[j] = (ta[j-1] + ta[j-2] + ta[j-3] + ta[j-4])%17;
}
max = n;
}
cout << ta[n] << '\n';
}
return 0;
}