結果

問題 No.741 AscNumber(Easy)
ユーザー PachicobuePachicobue
提出日時 2018-10-05 21:29:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 1,436 bytes
コンパイル時間 2,162 ms
コンパイル使用メモリ 198,668 KB
実行使用メモリ 26,652 KB
最終ジャッジ日時 2024-04-20 16:59:02
合計ジャッジ時間 4,154 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 1 ms
6,944 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 2 ms
6,944 KB
testcase_30 AC 1 ms
6,944 KB
testcase_31 AC 2 ms
6,940 KB
testcase_32 AC 2 ms
6,944 KB
testcase_33 AC 2 ms
6,940 KB
testcase_34 AC 2 ms
6,940 KB
testcase_35 AC 46 ms
25,692 KB
testcase_36 AC 21 ms
12,940 KB
testcase_37 AC 23 ms
14,648 KB
testcase_38 AC 23 ms
14,552 KB
testcase_39 AC 21 ms
12,944 KB
testcase_40 AC 27 ms
16,176 KB
testcase_41 AC 42 ms
23,552 KB
testcase_42 AC 22 ms
14,192 KB
testcase_43 AC 17 ms
11,008 KB
testcase_44 AC 31 ms
19,244 KB
testcase_45 AC 35 ms
20,384 KB
testcase_46 AC 43 ms
24,524 KB
testcase_47 AC 8 ms
6,940 KB
testcase_48 AC 47 ms
24,572 KB
testcase_49 AC 35 ms
21,052 KB
testcase_50 AC 7 ms
6,940 KB
testcase_51 AC 17 ms
11,532 KB
testcase_52 AC 49 ms
26,648 KB
testcase_53 AC 52 ms
26,652 KB
testcase_54 AC 48 ms
26,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define show(x) std::cerr << #x << " = " << x << std::endl
using ll = long long;
using ull = unsigned long long;
using ld = long double;
constexpr ll MOD = 1000000007LL;
template <typename T>
constexpr T INF = std::numeric_limits<T>::max() / 10;
std::mt19937 mt{std::random_device{}()};
template <ll mod = MOD>
class ModCombination
{
public:
    ModCombination(const std::size_t n) : fact(n + 1, 1), inv(n + 1, 1), inv_fact(n + 1, 1)
    {
        for (ll i = 2; i <= (ll)n; i++) { fact[i] = (fact[i - 1] * i) % mod, inv[i] = ((mod - (mod / i)) * inv[mod % i]) % mod, inv_fact[i] = (inv_fact[i - 1] * inv[i]) % mod; }
    }
    ll factorial(const std::size_t n) const { return fact[n]; }
    ll inverse(const std::size_t n) const { return inv[n]; }
    ll inverseFactorial(const std::size_t n) const { return inv_fact[n]; }
    ll permutation(const std::size_t n, const std::size_t k) const { return (fact[n] * inv_fact[n - k]) % mod; }
    ll combination(const std::size_t n, const std::size_t k) const { return (((fact[n] * inv_fact[k]) % mod) * inv_fact[n - k]) % mod; }
    ll homogenious(const std::size_t n, const std::size_t k) const { return (n == 0 and k == 0 ? 1 : combination(n + k - 1, k)); }

private:
    std::vector<ll> fact, inv, inv_fact;
};

int main()
{
    int N;
    std::cin >> N;
    ModCombination<> mod(N + 10);
    std::cout << mod.combination(N + 9, 9) << std::endl;

    return 0;
}
0