結果
問題 | No.657 テトラナッチ数列 Easy |
ユーザー |
![]() |
提出日時 | 2019-06-20 19:10:48 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 25 ms / 2,000 ms |
コード長 | 784 bytes |
コンパイル時間 | 1,134 ms |
コンパイル使用メモリ | 104,700 KB |
実行使用メモリ | 7,472 KB |
最終ジャッジ日時 | 2024-12-21 08:07:17 |
合計ジャッジ時間 | 2,425 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <stack> #include <queue> #include <list> #include <set> #include <map> #include <numeric> #include <regex> #include <tuple> #include<iomanip> using namespace std; typedef long long ll; typedef pair<int, int> P; #define MOD 1000000007 // 10^9 + 7 #define INF 1000000000 // 10^9 #define LLINF 1LL<<60 int T[1000009]; int main() { cin.tie(0); ios::sync_with_stdio(false); T[1] = T[2] = T[3] = 0; T[4] = 1; for (int i = 5; i <= 1000000; i++) { T[i] = T[i - 1] + T[i - 2] + T[i - 3] + T[i - 4]; T[i] %= 17; } int Q; cin >> Q; vector<int> ans; for (int i = 0; i < Q; i++) { int n; cin >> n; ans.push_back(T[n]); } for (int i = 0; i < Q; i++) cout << ans[i] << endl; return 0; }