結果

問題 No.741 AscNumber(Easy)
ユーザー treeonetreeone
提出日時 2018-10-05 21:32:06
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 194 ms / 2,000 ms
コード長 1,175 bytes
コンパイル時間 1,527 ms
コンパイル使用メモリ 164,136 KB
実行使用メモリ 19,200 KB
最終ジャッジ日時 2024-04-20 17:02:14
合計ジャッジ時間 13,177 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 183 ms
19,072 KB
testcase_01 AC 187 ms
19,072 KB
testcase_02 AC 190 ms
18,944 KB
testcase_03 AC 194 ms
18,944 KB
testcase_04 AC 188 ms
19,200 KB
testcase_05 AC 187 ms
19,072 KB
testcase_06 AC 189 ms
18,944 KB
testcase_07 AC 188 ms
19,072 KB
testcase_08 AC 187 ms
19,072 KB
testcase_09 AC 191 ms
19,072 KB
testcase_10 AC 191 ms
18,944 KB
testcase_11 AC 187 ms
18,944 KB
testcase_12 AC 192 ms
18,944 KB
testcase_13 AC 192 ms
18,944 KB
testcase_14 AC 192 ms
19,200 KB
testcase_15 AC 190 ms
19,072 KB
testcase_16 AC 189 ms
18,944 KB
testcase_17 AC 190 ms
19,072 KB
testcase_18 AC 186 ms
19,200 KB
testcase_19 AC 185 ms
19,072 KB
testcase_20 AC 187 ms
18,944 KB
testcase_21 AC 192 ms
19,072 KB
testcase_22 AC 187 ms
18,944 KB
testcase_23 AC 191 ms
18,944 KB
testcase_24 AC 186 ms
19,200 KB
testcase_25 AC 186 ms
19,072 KB
testcase_26 AC 188 ms
18,944 KB
testcase_27 AC 190 ms
18,944 KB
testcase_28 AC 192 ms
19,072 KB
testcase_29 AC 188 ms
19,072 KB
testcase_30 AC 185 ms
18,944 KB
testcase_31 AC 186 ms
18,944 KB
testcase_32 AC 187 ms
18,816 KB
testcase_33 AC 191 ms
19,200 KB
testcase_34 AC 189 ms
19,200 KB
testcase_35 AC 189 ms
19,072 KB
testcase_36 AC 189 ms
19,072 KB
testcase_37 AC 194 ms
19,072 KB
testcase_38 AC 193 ms
18,944 KB
testcase_39 AC 190 ms
18,944 KB
testcase_40 AC 186 ms
19,200 KB
testcase_41 AC 188 ms
19,072 KB
testcase_42 AC 185 ms
18,944 KB
testcase_43 AC 184 ms
18,944 KB
testcase_44 AC 188 ms
19,072 KB
testcase_45 AC 184 ms
19,072 KB
testcase_46 AC 188 ms
19,072 KB
testcase_47 AC 187 ms
19,072 KB
testcase_48 AC 193 ms
19,072 KB
testcase_49 AC 189 ms
19,072 KB
testcase_50 AC 185 ms
18,944 KB
testcase_51 AC 187 ms
18,944 KB
testcase_52 AC 187 ms
18,944 KB
testcase_53 AC 184 ms
18,944 KB
testcase_54 AC 185 ms
18,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e15;

long long mod_pow(long long x, long long n){
    if(n == 0) return 1;
    long long res = mod_pow(x*x % mod, n / 2);
    if(n & 1) res = res*x % mod;
    return res;
}

const int MAX_NUM = 1000010;
long long fact[MAX_NUM], inv[MAX_NUM];

long long comb(long long n, long long k){
    if(n < k || n < 0 || k < 0) return 0;
    if(fact[0] == 0){
        fact[0] = 1; inv[0] = 1;
        for(int i = 1; i < MAX_NUM; i++){
            fact[i] = fact[i - 1] * i % mod;
            inv[i] = mod_pow(fact[i], mod - 2);
        }
    }
    return (((fact[n] * inv[k]) % mod) * inv[n - k]) % mod; 
}

long long hcomb(long long n, long long k){
    if(n == 0 && k == 0) return 1;
    return comb(n + k - 1, k);
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    cout << comb(n + 9, 9) << endl;
}
0