結果

問題 No.129 お年玉(2)
ユーザー ngtkanangtkana
提出日時 2020-04-07 22:34:37
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 441 ms / 5,000 ms
コード長 938 bytes
コンパイル時間 1,929 ms
コンパイル使用メモリ 203,524 KB
実行使用メモリ 393,944 KB
最終ジャッジ日時 2023-09-22 15:49:48
合計ジャッジ時間 13,092 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
22,264 KB
testcase_01 AC 441 ms
393,944 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 178 ms
162,260 KB
testcase_06 AC 278 ms
256,664 KB
testcase_07 AC 344 ms
314,568 KB
testcase_08 AC 235 ms
214,404 KB
testcase_09 AC 315 ms
289,512 KB
testcase_10 AC 353 ms
325,832 KB
testcase_11 AC 226 ms
205,600 KB
testcase_12 AC 295 ms
268,524 KB
testcase_13 AC 308 ms
281,040 KB
testcase_14 AC 294 ms
271,448 KB
testcase_15 AC 242 ms
223,304 KB
testcase_16 AC 280 ms
254,124 KB
testcase_17 AC 336 ms
308,388 KB
testcase_18 AC 316 ms
290,592 KB
testcase_19 AC 338 ms
310,080 KB
testcase_20 AC 333 ms
307,716 KB
testcase_21 AC 416 ms
384,792 KB
testcase_22 AC 239 ms
216,904 KB
testcase_23 AC 365 ms
335,836 KB
testcase_24 AC 351 ms
322,680 KB
testcase_25 AC 228 ms
206,868 KB
testcase_26 AC 230 ms
211,804 KB
testcase_27 AC 227 ms
205,428 KB
testcase_28 AC 421 ms
388,764 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 4 ms
5,336 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 3 ms
5,092 KB
testcase_36 AC 4 ms
5,444 KB
testcase_37 AC 5 ms
6,232 KB
testcase_38 AC 47 ms
44,788 KB
testcase_39 AC 71 ms
67,660 KB
testcase_40 AC 211 ms
192,088 KB
testcase_41 AC 129 ms
117,028 KB
testcase_42 AC 54 ms
50,448 KB
testcase_43 AC 52 ms
49,660 KB
testcase_44 AC 425 ms
390,876 KB
testcase_45 AC 29 ms
28,748 KB
testcase_46 AC 79 ms
75,772 KB
testcase_47 AC 407 ms
377,376 KB
testcase_48 AC 250 ms
226,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
using lint=long long;
using lubl=long double;
lint mod=1'000'000'000;
struct mint{
    lint value;
    mint()=default;
    mint(lint x):value(x){}
};
std::ostream&operator<<(std::ostream&os,mint x){return os<<x.value;}
mint operator+(mint x,mint y){lint z=x.value+y.value;if(mod<=z)z-=mod;return z;}
mint&operator+=(mint&x,mint y){return x=x+y;}
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint a,b;std::cin>>a>>b;
    a/=1'000;
    a%=b;
    std::vector<std::vector<mint>>binom(b+1);
    binom.at(0)={1};
    for(lint i=0;i<b;i++){
        binom.at(i+1).resize(i+2);
        for(lint j=0;j<=i;j++){
            mint x=binom.at(i).at(j);
            binom.at(i+1).at(j)+=x;
            binom.at(i+1).at(j+1)+=x;
        }
    }
    std::cout<<binom.at(b).at(a)<<'\n';
}
0