結果
| 問題 | No.657 テトラナッチ数列 Easy |
| コンテスト | |
| ユーザー |
CreativeGP1
|
| 提出日時 | 2018-03-04 23:37:19 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 840 bytes |
| コンパイル時間 | 770 ms |
| コンパイル使用メモリ | 71,216 KB |
| 実行使用メモリ | 136,192 KB |
| 最終ジャッジ日時 | 2024-07-17 23:21:10 |
| 合計ジャッジ時間 | 11,835 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 TLE * 1 |
| other | AC * 5 WA * 6 TLE * 2 |
ソースコード
/* ========================================================================
$File: $
$Date: $
$Revision: $
$Creator: Creative GP $
$Notice: (C) Copyright 2017 by Creative GP, Inc. All Rights Reserved. $
======================================================================== */
#define CPP
#include <iostream>
#include <string>
#include <array>
#include <algorithm>
#include <map>
#include <list>
#define ll long long
using namespace std;
map<ll,ll> memo = {
{1, 0},
{2, 0},
{3, 0},
{4, 1}
};
int tetra(ll n) {
if (memo.find(n) != memo.end()) return memo[n];
memo[n] = tetra(n-1)+tetra(n-2)+tetra(n-3)+tetra(n-4);
return memo[n];
}
int main()
{
ll Q;
cin >> Q;
for (ll i = 0; i < Q; i++) {
int t;
cin >> t;
cout << tetra(t) % 17 << endl;
}
}
CreativeGP1