結果
問題 | No.129 お年玉(2) |
ユーザー |
![]() |
提出日時 | 2019-04-27 17:40:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,151 bytes |
コンパイル時間 | 1,580 ms |
コンパイル使用メモリ | 161,164 KB |
実行使用メモリ | 612,156 KB |
最終ジャッジ日時 | 2025-02-20 03:56:32 |
合計ジャッジ時間 | 15,615 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | MLE * 3 |
other | MLE * 46 |
ソースコード
#include<bits/stdc++.h>using namespace std;using ll = long long;#define FOR(i,a,b) for(ll i=(a);i<(b);++i)#define ALL(v) (v).begin(), (v).end()#define p(s) cout<<(s)<<endl#define p2(s, t) cout << (s) << " " << (t) << endl#define br() p("")#define pn(s) cout << (#s) << " " << (s) << endl#define p_yes() p("Yes")#define p_no() p("No")const ll mod = 1e9 + 7;const ll inf = 1e18;template < typename T >void vprint(T &V){for(auto v : V){cout << v << " ";}cout << endl;}// パスカルの三角形セットconst int N_MAX = 10010;ll pascal[N_MAX][N_MAX] = {};void calc_pascal(){FOR(i, 0, N_MAX){pascal[i][0] = 1;}pascal[1][1] = 1;FOR(i, 2, N_MAX){for(int j=1; j<=i; j++){pascal[i][j] = pascal[i-1][j] + pascal[i-1][j-1];pascal[i][j] %= 1000000000; // 今回の問題用}}}ll nCr(ll n, ll r){return pascal[n][r];}int main(){cin.tie(0);ios::sync_with_stdio(false);// inputll N, M;cin >> N >> M;N /= 1000;ll rest = N%M;calc_pascal();ll ans = nCr(M, rest);p(ans);return 0;}