結果
問題 |
No.129 お年玉(2)
|
ユーザー |
|
提出日時 | 2016-05-04 21:49:26 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 611 bytes |
コンパイル時間 | 769 ms |
コンパイル使用メモリ | 75,236 KB |
実行使用メモリ | 785,664 KB |
最終ジャッジ日時 | 2024-10-05 06:40:51 |
合計ジャッジ時間 | 45,099 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | MLE * 3 |
other | MLE * 46 |
ソースコード
#include <iostream> #include <cmath> #include <vector> using ll = long long int; std::vector<std::vector<ll>> memo(10000, std::vector<ll>(10000, -1)); ll Combination(ll n, ll r, ll mod){ if(memo[n-1][r]!=-1) return memo[n-1][r]; if(r==0 || n==r){ memo[n-1][r] = 1; return 1; } memo[n-1][r] = (Combination(n-1, r-1, mod) + Combination(n-1, r, mod))%mod; return memo[n-1][r]; } int main(){ std::ios::sync_with_stdio(false); std::cin.tie(0); ll n, m; std::cin >> n >> m; std::cout << Combination(m, (n/1000)%m, 1000000000) << "\n"; return 0; }