結果
問題 | No.741 AscNumber(Easy) |
ユーザー |
|
提出日時 | 2018-10-05 22:15:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,295 bytes |
コンパイル時間 | 1,042 ms |
コンパイル使用メモリ | 115,620 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-12 13:13:02 |
合計ジャッジ時間 | 2,537 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 55 |
ソースコード
#define _USE_MATH_DEFINES #include <cstdio> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <cmath> #include <complex> #include <string> #include <vector> #include <array> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <limits> #include <climits> #include <cfloat> #include <functional> #include <iterator> #include <memory> #include <regex> using namespace std; const int MOD = 1000000007; long long extgcd(long long a, long long b, long long &x, long long &y) { long long g = a; if(b != 0){ g = extgcd(b, a % b, y, x); y -= (a / b) * x; }else{ x = 1; y = 0; } return g; } long long mod_inverse(long long a, long long m) { long long x, y; extgcd(a, m, x, y); return (x % m + m) % m; } long long combination(int n, int r) { if(n < r) return 0; if(n-r < r) r = n-r; long long ret = 1; for(int i=0; i<r; i++){ ret *= (n--); ret %= MOD; ret *= mod_inverse(i+1, MOD); ret %= MOD; } return ret; } int main() { int n; cin >> n; long long ans = combination(n + 9, 9); cout << ans << endl; return 0; }