結果

問題 No.129 お年玉(2)
ユーザー satanicsatanic
提出日時 2016-05-04 21:56:44
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,165 ms / 5,000 ms
コード長 613 bytes
コンパイル時間 572 ms
コンパイル使用メモリ 74,332 KB
実行使用メモリ 394,808 KB
最終ジャッジ日時 2023-08-18 17:42:02
合計ジャッジ時間 27,984 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 293 ms
394,356 KB
testcase_01 AC 305 ms
394,664 KB
testcase_02 AC 273 ms
394,164 KB
testcase_03 AC 272 ms
394,192 KB
testcase_04 AC 273 ms
394,180 KB
testcase_05 AC 416 ms
394,620 KB
testcase_06 AC 808 ms
394,628 KB
testcase_07 AC 791 ms
394,808 KB
testcase_08 AC 379 ms
394,548 KB
testcase_09 AC 888 ms
394,628 KB
testcase_10 AC 782 ms
394,736 KB
testcase_11 AC 657 ms
394,644 KB
testcase_12 AC 400 ms
394,612 KB
testcase_13 AC 363 ms
394,552 KB
testcase_14 AC 865 ms
394,580 KB
testcase_15 AC 728 ms
394,620 KB
testcase_16 AC 775 ms
394,552 KB
testcase_17 AC 864 ms
394,612 KB
testcase_18 AC 719 ms
394,796 KB
testcase_19 AC 492 ms
394,788 KB
testcase_20 AC 898 ms
394,572 KB
testcase_21 AC 1,040 ms
394,720 KB
testcase_22 AC 636 ms
394,640 KB
testcase_23 AC 833 ms
394,764 KB
testcase_24 AC 379 ms
394,744 KB
testcase_25 AC 660 ms
394,656 KB
testcase_26 AC 547 ms
394,572 KB
testcase_27 AC 557 ms
394,568 KB
testcase_28 AC 1,165 ms
394,656 KB
testcase_29 AC 272 ms
394,288 KB
testcase_30 AC 269 ms
394,224 KB
testcase_31 AC 272 ms
394,208 KB
testcase_32 AC 273 ms
394,284 KB
testcase_33 AC 269 ms
394,200 KB
testcase_34 AC 269 ms
394,216 KB
testcase_35 AC 274 ms
394,328 KB
testcase_36 AC 273 ms
394,356 KB
testcase_37 AC 269 ms
394,316 KB
testcase_38 AC 337 ms
394,444 KB
testcase_39 AC 368 ms
394,384 KB
testcase_40 AC 622 ms
394,496 KB
testcase_41 AC 465 ms
394,428 KB
testcase_42 AC 346 ms
394,660 KB
testcase_43 AC 317 ms
394,480 KB
testcase_44 AC 602 ms
394,664 KB
testcase_45 AC 317 ms
394,344 KB
testcase_46 AC 327 ms
394,364 KB
testcase_47 AC 765 ms
394,752 KB
testcase_48 AC 418 ms
394,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
#include <vector>

using ll = long long int;

std::vector<std::vector<int>> memo(10000, std::vector<int>(10000, -1));

ll Combination(ll n, ll r, ll mod){
    if(memo[n-1][r]!=-1) return memo[n-1][r];
    if(r==0 || n==r){
        memo[n-1][r] = 1;
        return 1;
    }
    memo[n-1][r] = (Combination(n-1, r-1, mod) + Combination(n-1, r, mod))%mod;
    return memo[n-1][r];
} 

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    
    ll n, m;
    std::cin >> n >> m;
    std::cout << Combination(m, (n/1000)%m, 1000000000) << "\n";
    return 0;

}
0