結果
問題 |
No.44 DPなすごろく
|
ユーザー |
|
提出日時 | 2025-09-23 11:52:55 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 417 bytes |
コンパイル時間 | 3,405 ms |
コンパイル使用メモリ | 275,196 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-23 11:53:00 |
合計ジャッジ時間 | 4,946 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> [[nodiscard]] static inline constexpr int_fast64_t solve(const int_fast64_t N) noexcept { std::array<int_fast64_t, 2> dp = { 1, 1 }; for (int_fast32_t i = 2; i <= N; ++i) dp[i & 1] = dp[i & 1] + dp[(i & 1) ^ 1]; return dp[N & 1]; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int_fast32_t N; std::cin >> N; std::cout << solve(N) << '\n'; return 0; }