-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhowDoYouAddOJ.cpp
55 lines (49 loc) · 1009 Bytes
/
howDoYouAddOJ.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#include <climits>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
vector<vector<int>> dp(101, vector<int>(101, 0));
for (int i = 0; i <= 100; ++i)
{
dp[0][i] = 1;
dp[i][1] = 1;
}
for (int j = 2; j <= 100; ++j)
{
for (int i = 1; i <= 100; ++i)
{
for (int k = 0; k <= i; ++k)
{
dp[i][j] += dp[k][j - 1] % 1000000;
dp[i][j] %= 1000000;
}
}
}
while (true)
{
int n = 0, k = 0;
cin >> n >> k;
if (n + k == 0)
{
break;
}
else
{
cout << dp[n][k] << '\n';
}
}
cout.flush();
return 0;
}