結果

問題 No.129 お年玉(2)
ユーザー ry0u_ydry0u_yd
提出日時 2015-09-02 22:50:29
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 363 ms / 5,000 ms
コード長 813 bytes
コンパイル時間 606 ms
コンパイル使用メモリ 66,976 KB
実行使用メモリ 433,664 KB
最終ジャッジ日時 2024-05-05 22:49:52
合計ジャッジ時間 17,218 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 363 ms
433,408 KB
testcase_01 AC 330 ms
433,536 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 333 ms
433,536 KB
testcase_04 AC 330 ms
433,536 KB
testcase_05 AC 331 ms
433,408 KB
testcase_06 AC 332 ms
433,536 KB
testcase_07 AC 329 ms
433,536 KB
testcase_08 AC 334 ms
433,408 KB
testcase_09 AC 335 ms
433,408 KB
testcase_10 AC 331 ms
433,536 KB
testcase_11 AC 329 ms
433,536 KB
testcase_12 AC 328 ms
433,280 KB
testcase_13 AC 339 ms
433,408 KB
testcase_14 AC 357 ms
433,408 KB
testcase_15 AC 334 ms
433,408 KB
testcase_16 AC 339 ms
433,408 KB
testcase_17 AC 332 ms
433,408 KB
testcase_18 AC 336 ms
433,408 KB
testcase_19 AC 334 ms
433,408 KB
testcase_20 AC 341 ms
433,536 KB
testcase_21 AC 332 ms
433,408 KB
testcase_22 AC 332 ms
433,536 KB
testcase_23 AC 335 ms
433,408 KB
testcase_24 AC 336 ms
433,408 KB
testcase_25 AC 330 ms
433,536 KB
testcase_26 AC 333 ms
433,408 KB
testcase_27 AC 334 ms
433,664 KB
testcase_28 AC 330 ms
433,536 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 326 ms
433,408 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 331 ms
433,408 KB
testcase_35 AC 331 ms
433,408 KB
testcase_36 AC 326 ms
433,408 KB
testcase_37 AC 328 ms
433,536 KB
testcase_38 AC 325 ms
433,408 KB
testcase_39 AC 330 ms
433,408 KB
testcase_40 AC 328 ms
433,408 KB
testcase_41 AC 325 ms
433,280 KB
testcase_42 AC 330 ms
433,408 KB
testcase_43 AC 351 ms
433,536 KB
testcase_44 AC 334 ms
433,408 KB
testcase_45 AC 336 ms
433,408 KB
testcase_46 AC 336 ms
433,408 KB
testcase_47 AC 333 ms
433,408 KB
testcase_48 AC 333 ms
433,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair
#define MOD 1000000000

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll dp[10005][10005];

int main() {
    ll n,m;
    cin >> n >> m;

    n = n/1000;
    if(n % m == 0) {
        cout << 1 << endl;
    } else {
        int d = n % m;
        rep(i,10005) {
            dp[i][0] = 1;
            dp[i][i] = 1;

            REP(j,1,i) {
                dp[i][j] = dp[i-1][j-1] + dp[i-1][j];
                dp[i][j] %= MOD;
            }
        }

        cout << dp[m][d] << endl;
    }
    return 0;
}
0