結果
| 問題 |
No.129 お年玉(2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-08-27 14:42:22 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 765 bytes |
| コンパイル時間 | 794 ms |
| コンパイル使用メモリ | 73,408 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-01 04:07:38 |
| 合計ジャッジ時間 | 6,732 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 RE * 37 |
ソースコード
#include<iostream>
#include<vector>
using namespace std;
int mod = 1e9;
struct Combination{
int n;
vector<vector<int>> dp;
Combination(int i){
n = i;
dp = vector<vector<int>>(n+1, vector<int>(n+1, 0));
constructTriangle();
}
void constructTriangle(){
dp[0][0] = 1;
for(int i = 1; i <= n; i++){
dp[i][0] = dp[i-1][0];
for(int j = 1; j <= i; j++){
dp[i][j] = (dp[i-1][j] + dp[i-1][j-1]) % mod;
}
}
}
// return aCb
int getCombination(int a, int b){
return dp[a][b];
}
};
int main(){
int n, m;
cin >> n >> m;
n /= 1000;
Combination c(m);
cout << c.getCombination(m, n%m) << endl;
return 0;
}