結果

問題 No.657 テトラナッチ数列 Easy
コンテスト
ユーザー gemmaro
提出日時 2020-06-10 20:36:22
言語 C++17(clang)
(clang++ 22.1.2 + boost 1.89.0)
コンパイル:
clang++ -O2 -lm -std=c++1z -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 638 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 407 ms
コンパイル使用メモリ 108,928 KB
最終ジャッジ日時 2026-05-24 09:20:25
合計ジャッジ時間 1,282 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp:5:24: error: use of undeclared identifier 'uint32_t'
    5 | void solve(std::vector<uint32_t>& n) {
      |                        ^~~~~~~~
main.cpp:6:11: error: unknown type name 'uint32_t'
    6 |     const uint32_t n_max = *std::max_element(n.begin(), n.end());
      |           ^
main.cpp:7:17: error: use of undeclared identifier 'uint32_t'
    7 |     std::vector<uint32_t> a{0, 0, 0, 1};
      |                 ^~~~~~~~
main.cpp:9:10: error: unknown type name 'uint32_t'
    9 |     for (uint32_t i = 4; i < n_max; ++i) {
      |          ^
main.cpp:17:5: error: unknown type name 'uint32_t'
   17 |     uint32_t q;
      |     ^
main.cpp:19:17: error: use of undeclared identifier 'uint32_t'
   19 |     std::vector<uint32_t> n{};
      |                 ^~~~~~~~
main.cpp:20:10: error: unknown type name 'uint32_t'
   20 |     for (uint32_t i = 0; i < q; ++i) {
      |          ^
main.cpp:21:9: error: unknown type name 'uint32_t'
   21 |         uint32_t m;
      |         ^
8 errors generated.

ソースコード

diff #
raw source code

#include <algorithm>
#include <iostream>
#include <vector>

void solve(std::vector<uint32_t>& n) {
    const uint32_t n_max = *std::max_element(n.begin(), n.end());
    std::vector<uint32_t> a{0, 0, 0, 1};
    a.resize(n_max);
    for (uint32_t i = 4; i < n_max; ++i) {
        a[i] = (a.at(i - 4) + a.at(i - 3) + a.at(i - 2) + a.at(i - 1)) % 17;
    }
    for (auto i : n) {
        std::cout << a[i - 1] << std::endl;
    }
}
int32_t main() {
    uint32_t q;
    std::cin >> q;
    std::vector<uint32_t> n{};
    for (uint32_t i = 0; i < q; ++i) {
        uint32_t m;
        std::cin >> m;
        n.push_back(m);
    }
    solve(n);
}
0