結果
問題 | No.657 テトラナッチ数列 Easy |
ユーザー |
![]() |
提出日時 | 2020-08-18 22:28:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 692 bytes |
コンパイル時間 | 1,505 ms |
コンパイル使用メモリ | 169,940 KB |
実行使用メモリ | 11,132 KB |
最終ジャッジ日時 | 2024-10-12 03:16:41 |
合計ジャッジ時間 | 2,390 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using ul = unsigned long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int q; cin >> q; vector<long> vn(q); for (auto&& n : vn) cin >> n; auto it = max_element(vn.begin(), vn.end()); long maxq = *it; vector<ll> t(maxq + 1, 0); if (maxq > 4) { t[1] = 0; t[2] = 0; t[3] = 0; t[4] = 1; for (long i = 5; i <= maxq; ++i) t[i] = (t[i - 1] + t[i - 2] + t[i - 3] + t[i - 4]) % 17; } else if (maxq == 4) t[4] = 1; for (const auto& n : vn) cout << t[n] << "\n"; return 0; }