結果
| 問題 |
No.657 テトラナッチ数列 Easy
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-26 06:50:05 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 2,000 ms |
| コード長 | 546 bytes |
| コンパイル時間 | 1,702 ms |
| コンパイル使用メモリ | 169,596 KB |
| 実行使用メモリ | 7,376 KB |
| 最終ジャッジ日時 | 2024-09-16 04:54:25 |
| 合計ジャッジ時間 | 2,449 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int mx = *max_element(a.begin(), a.end());
int t[mx + 1] = {};
for (int i = 1; i <= mx; i++) {
if (i == 1 || i == 2 || i == 3) t[i] = 0;
else if (i == 4) t[i] = 1;
else {
t[i] = t[i - 1] + t[i - 2] + t[i - 3] + t[i - 4];
t[i] %= 17;
}
}
for (int i = 0; i < n; i++) {
cout << t[a[i]] << '\n';
}
return 0;
}