forked from fatemehkarimi/uvaSolutions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuva-10446.cpp
More file actions
41 lines (31 loc) · 845 Bytes
/
uva-10446.cpp
File metadata and controls
41 lines (31 loc) · 845 Bytes
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
//uva 10446
//The Marriage Interview ;-)
#include <iostream>
using namespace std;
int main(void)
{
int tcounter = 0;
unsigned long long int arr[61][61];
for (int i = 0; i < 61; ++i)
for (int j = 0; j < 61; ++j)
arr[i][j] = 1;
for (int j = 2; j < 61; ++j)
for (int i = 0; i < 61; ++i)
for (int k = 1; k <= i; ++k)
if (j >= k)
arr[i][j] += (arr[i][j - k]);
else if (j < k)
arr[i][j] += arr[i][0];
while (1){
int a, b;
cin >> a >> b;
if (a > 60 || b > 60)
break;
++tcounter;
if (a >= 0)
cout << "Case " << tcounter << ": " << arr[b][a] << endl;
else
cout << "Case " << tcounter << ": " << 1 << endl;
}
return 0;
}