結果
問題 | No.741 AscNumber(Easy) |
ユーザー |
![]() |
提出日時 | 2018-10-05 21:32:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 200 ms / 2,000 ms |
コード長 | 1,175 bytes |
コンパイル時間 | 1,567 ms |
コンパイル使用メモリ | 167,116 KB |
実行使用メモリ | 19,072 KB |
最終ジャッジ日時 | 2024-10-12 12:53:58 |
合計ジャッジ時間 | 13,570 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 55 |
ソースコード
#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; }