-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10164.cpp
More file actions
51 lines (43 loc) · 888 Bytes
/
10164.cpp
File metadata and controls
51 lines (43 loc) · 888 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
42
43
44
45
46
47
48
49
50
51
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int n,m,k,a,b;
int arr[16][16];
int main(int argc, char** argv)
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>n>>m>>k;
int cnt = 0;
for (int i = 1; i <= n; i++)
{
for(int j = 1; j <= m;j++)
{
cnt++;
if(cnt==k)
{
a = i;
b = j;
}
}
}
arr[1][1] = 1;
for (int i = 1; i <= n; i++)
{
for(int j = 1; j<=m; j++)
{
if(i==1&&j==1) continue;
if((i>a&&j<b)||(i<a&&j>b)) arr[i][j] = 0;
else
{
arr[i][j] = arr[i-1][j] + arr[i][j-1];
}
}
}
cout<<arr[n][m]<<"\n";
return 0;
}