forked from Akanksha1212/C_Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelectionOfObject.c
More file actions
52 lines (40 loc) · 938 Bytes
/
SelectionOfObject.c
File metadata and controls
52 lines (40 loc) · 938 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
52
#include<stdio.h>
#include<math.h>
//====================================================
int max(int a, int b){
if(a>=b)
return a;
else
return b;
}
//====================================================
int min(int a, int b){
if(a>=b)
return b;
else
return a;
}
//======================================================
int main(){
long long int T,j,ans,x,y,n,r,l,m,a=1,b=1;
int M=1000000007;
printf(" (n)!\n");
printf("ENTER n AND r OF FORM ____________ \n");
printf(" (r)!(n-r)!\n\n\n");
scanf("%lld %lld",&n,&r);
//------------------------------------------------------------
y=r;
x=n-r;
l= min(x,y);
m= max(x,y);
a=1;
b=1;
for(j=1;j<=l;j++){
a=((a%M)*(j%M))%M;
b=((b%M)*((m+j)%M))%M;
}
ans=(b%M)/(a%M);
printf("\n%lld\n", ans);
//-------------------------------------------------------------
return 0;
}