結果
| 問題 | No.129 お年玉(2) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-08-27 14:42:22 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 765 bytes |
| 記録 | |
| コンパイル時間 | 525 ms |
| コンパイル使用メモリ | 82,388 KB |
| 実行使用メモリ | 120,064 KB |
| 最終ジャッジ日時 | 2026-03-21 22:02:22 |
| 合計ジャッジ時間 | 4,735 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 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;
}