-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshopee1.cpp
51 lines (42 loc) · 859 Bytes
/
shopee1.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
#include <iostream>
using namespace std;
int main()
{
int x, y, man_num = 0;
long long a[40][40];
bool man[40][40];
cin >> x >> y >> man_num;
for (int i = 0; i <= x; i++)
{
for (int j = 0; j <= y; j++)
{
man[i][j] = true;
}
}
while (man_num--)
{
int man_x, man_y;
cin >> man_x >> man_y;
man[man_x][man_y] = false;
}
for (int i = 0; i <= x; i++)
{
for (int j = 0; j <= y; j++)
{
if (i == 0 || j == 0)
{
a[i][j] = 1;
}
else if (!man[i][j])
{
a[i][j] = 0;
}
else
{
a[i][j] = a[i - 1][j] + a[i][j - 1];
}
}
}
cout << a[x][y] << endl;
return 0;
}