結果
問題 | No.657 テトラナッチ数列 Easy |
ユーザー |
![]() |
提出日時 | 2019-03-09 11:08:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 24 ms / 2,000 ms |
コード長 | 534 bytes |
コンパイル時間 | 1,675 ms |
コンパイル使用メモリ | 170,524 KB |
実行使用メモリ | 11,164 KB |
最終ジャッジ日時 | 2024-06-23 15:11:55 |
合計ジャッジ時間 | 2,561 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n, maxi = -1e9; cin >> n; vector<long long> A(n); for(int i = 0; i < n; i++){ cin >> A[i]; maxi = max((long long)maxi, A[i]); } vector<long long> T(maxi + 1); T[4] = 1; for(int i = 5; i <= maxi; i++){ T[i] += (T[i - 1] + T[i - 2] + T[i - 3] + T[i - 4]) % 17; } for(int i = 0; i < n; i++){ cout << T[A[i]] % 17 << endl; } return 0; }