-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10164.cpp
More file actions
39 lines (33 loc) · 711 Bytes
/
Copy path10164.cpp
File metadata and controls
39 lines (33 loc) · 711 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
#include <stdio.h>
int n, m, k, x=1, y=1, count=0, sum = 0;
void getRoute(int sx, int sy, int ex, int ey){
if(sx==ex and sy==ey){
count++;
return;
}
if(sx <ex){
getRoute(sx+1, sy, ex, ey);
}
if(sy < ey){
getRoute(sx, sy+1, ex, ey);
}
}
int main() {
//Please Enter Your Code Here
scanf("%d %d %d", &n, &m, &k);
if(k>0){
if(k<=m) x=1;
else if(k%m==0) x = k / m;
else x = k / m + 1;
y = k % m;
if(y==0) y=m;
getRoute(1, 1, x, y);
sum = count;
count = 0;
}
getRoute(x, y, n, m);
if(count==0) printf("%d", sum);
else if(sum == 0) printf("%d", count);
else printf("%d", sum*count);
return 0;
}