結果

問題 No.129 お年玉(2)
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2019-04-30 01:35:25
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 980 bytes
コンパイル時間 779 ms
コンパイル使用メモリ 76,448 KB
実行使用メモリ 784,912 KB
最終ジャッジ日時 2023-08-26 21:07:21
合計ジャッジ時間 16,632 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
41,464 KB
testcase_01 MLE -
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 269 ms
321,356 KB
testcase_06 AC 403 ms
509,836 KB
testcase_07 MLE -
testcase_08 AC 338 ms
425,400 KB
testcase_09 MLE -
testcase_10 MLE -
testcase_11 AC 324 ms
408,028 KB
testcase_12 MLE -
testcase_13 MLE -
testcase_14 MLE -
testcase_15 AC 349 ms
443,296 KB
testcase_16 AC 398 ms
504,664 KB
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 MLE -
testcase_22 AC 347 ms
430,208 KB
testcase_23 MLE -
testcase_24 MLE -
testcase_25 AC 332 ms
410,272 KB
testcase_26 AC 338 ms
420,612 KB
testcase_27 AC 326 ms
407,760 KB
testcase_28 MLE -
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 5 ms
7,748 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 4 ms
6,896 KB
testcase_36 AC 5 ms
7,688 KB
testcase_37 AC 5 ms
9,012 KB
testcase_38 AC 69 ms
86,080 KB
testcase_39 AC 111 ms
132,308 KB
testcase_40 AC 308 ms
380,940 KB
testcase_41 AC 191 ms
230,772 KB
testcase_42 AC 82 ms
98,108 KB
testcase_43 AC 80 ms
96,240 KB
testcase_44 MLE -
testcase_45 AC 40 ms
54,056 KB
testcase_46 AC 118 ms
148,248 KB
testcase_47 MLE -
testcase_48 AC 360 ms
449,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#include <set>
#include <cstdio>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define P pair<int, int>

#define MOD 1000000007
#define INF 1012345678
#define NINF (-2147483647-1)
#define LLINF 9223372036854775807
using ll = long long;
using namespace std;

// combination
ll comb(ll n, ll r) {
    vector<vector<ll>> v(n + 1, vector<ll>(n + 1, 0));
    for (ll i = 0; i < (ll)v.size(); i++) {
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for (ll j = 1; j < (ll)v.size(); j++) {
        for (ll k = 1; k < j; k++) {
            v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]) % 1000000000;
        }
    }
    return v[n][r];
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M;
    cin >> N >> M;
    cout << comb(M, N / 1000 % M) << endl;
    getchar(); getchar();
}
0