提出 #64756943


ソースコード 拡げる

#include <iostream>
#include <vector>
using namespace std;
#define int long long
const int MOD = 1e9;

signed main() {
    int n, k;
    cin >> n >> k;

    vector<int> a(n + 1, 0);
    for (int i = 0; i < k && i <= n; ++i) {
        a[i] = 1;
    }

    int win = k <= n ? k : 0; 
    for (int i = k; i <= n; ++i) {
        a[i] = win % MOD;
        win += a[i];
        win -= a[i - k];
    }

    cout << a[n] % MOD << '\n';
}

提出情報

提出日時
問題 C - K-bonacci
ユーザ sivasaran2003
言語 C++ 17 (gcc 12.2)
得点 300
コード長 454 Byte
結果 AC
実行時間 8 ms
メモリ 11148 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 34
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3536 KiB
00_sample_01.txt AC 1 ms 3520 KiB
00_sample_02.txt AC 6 ms 11032 KiB
01_random_00.txt AC 2 ms 5272 KiB
01_random_01.txt AC 3 ms 6496 KiB
01_random_02.txt AC 3 ms 8312 KiB
01_random_03.txt AC 7 ms 10568 KiB
01_random_04.txt AC 5 ms 8756 KiB
01_random_05.txt AC 2 ms 6308 KiB
01_random_06.txt AC 5 ms 10784 KiB
01_random_07.txt AC 7 ms 10760 KiB
01_random_08.txt AC 3 ms 8188 KiB
01_random_09.txt AC 7 ms 10304 KiB
01_random_10.txt AC 4 ms 8680 KiB
01_random_11.txt AC 2 ms 5584 KiB
01_random_12.txt AC 4 ms 7380 KiB
01_random_13.txt AC 1 ms 3708 KiB
01_random_14.txt AC 3 ms 5988 KiB
01_random_15.txt AC 2 ms 5548 KiB
01_random_16.txt AC 2 ms 5028 KiB
01_random_17.txt AC 5 ms 9716 KiB
01_random_18.txt AC 4 ms 9472 KiB
01_random_19.txt AC 1 ms 3760 KiB
01_random_20.txt AC 7 ms 11024 KiB
01_random_21.txt AC 7 ms 10996 KiB
01_random_22.txt AC 7 ms 11068 KiB
01_random_23.txt AC 7 ms 11000 KiB
01_random_24.txt AC 7 ms 11080 KiB
01_random_25.txt AC 1 ms 3540 KiB
01_random_26.txt AC 8 ms 11064 KiB
01_random_27.txt AC 8 ms 11148 KiB
01_random_28.txt AC 1 ms 3404 KiB
01_random_29.txt AC 5 ms 11068 KiB
01_random_30.txt AC 3 ms 7044 KiB