結果

問題 No.129 お年玉(2)
ユーザー snrnsidysnrnsidy
提出日時 2021-05-23 04:04:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 107 ms / 5,000 ms
コード長 704 bytes
コンパイル時間 1,885 ms
コンパイル使用メモリ 194,068 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-19 11:35:30
合計ジャッジ時間 5,613 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
6,812 KB
testcase_01 AC 105 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 54 ms
6,940 KB
testcase_06 AC 77 ms
6,940 KB
testcase_07 AC 89 ms
6,944 KB
testcase_08 AC 67 ms
6,944 KB
testcase_09 AC 83 ms
6,940 KB
testcase_10 AC 92 ms
6,940 KB
testcase_11 AC 65 ms
6,940 KB
testcase_12 AC 80 ms
6,940 KB
testcase_13 AC 83 ms
6,940 KB
testcase_14 AC 82 ms
6,944 KB
testcase_15 AC 69 ms
6,940 KB
testcase_16 AC 76 ms
6,940 KB
testcase_17 AC 88 ms
6,940 KB
testcase_18 AC 85 ms
6,940 KB
testcase_19 AC 88 ms
6,940 KB
testcase_20 AC 87 ms
6,940 KB
testcase_21 AC 107 ms
6,940 KB
testcase_22 AC 69 ms
6,940 KB
testcase_23 AC 95 ms
6,940 KB
testcase_24 AC 93 ms
6,940 KB
testcase_25 AC 65 ms
6,940 KB
testcase_26 AC 65 ms
6,940 KB
testcase_27 AC 65 ms
6,940 KB
testcase_28 AC 105 ms
6,940 KB
testcase_29 AC 1 ms
6,940 KB
testcase_30 AC 2 ms
6,944 KB
testcase_31 AC 2 ms
6,940 KB
testcase_32 AC 2 ms
6,940 KB
testcase_33 AC 5 ms
6,940 KB
testcase_34 AC 4 ms
6,944 KB
testcase_35 AC 6 ms
6,940 KB
testcase_36 AC 6 ms
6,940 KB
testcase_37 AC 6 ms
6,940 KB
testcase_38 AC 22 ms
6,940 KB
testcase_39 AC 30 ms
6,940 KB
testcase_40 AC 61 ms
6,944 KB
testcase_41 AC 43 ms
6,940 KB
testcase_42 AC 25 ms
6,940 KB
testcase_43 AC 24 ms
6,944 KB
testcase_44 AC 107 ms
6,944 KB
testcase_45 AC 18 ms
6,940 KB
testcase_46 AC 32 ms
6,944 KB
testcase_47 AC 105 ms
6,940 KB
testcase_48 AC 74 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

const long long int MOD = 1e9;
long long int C[2][10001];
int main() 
{
    ios::sync_with_stdio(false); 
    cin.tie(0);
    
    long long int N, M;

    cin >> N;
    cin >> M;

    long long int A = N - ((N / (M * 1000)) * M * 1000LL);
    A /= 1000;

    //cout << M << ' ' << A << '\n';

    C[1][0] = 1;
    for (int i = 1; i <= M; i++)
    {
        memcpy(C[0], C[1], sizeof(C[1]));
        memset(C[1], 0, sizeof(C[1]));
        C[1][0] = 1;
        C[1][i] = 1;
        for (int j = 1; j < i; j++)
        {
            C[1][j] = C[0][j] + C[0][j - 1];
            C[1][j] %= MOD;
        }
    }

    cout << C[1][A] << '\n';
    return 0;
}


0