Time Limit: 1000 MS | memory limit: 65535 kb difficulty: 2
-
Description
-
The annual Henan Program Design Competition is coming again.
The competition requires a team. In the form of a team, three members form a team, with one captain and two players.
Now the problem is coming. For m people, ask n people in each team. There are several different teams.
(Ensure that M % N is equal to 0, and all data does not exceed the int range)
-
Input
-
Multiple groups of test data, ended with EOF.
Input two integers (m, n) for each group of test data.
-
Output
-
Output the number of different teams for each group of test data (considering that the number of outputs may be large, please output the value after the remainder of 2013 ), enter a line break after the output ends.
-
Sample Input
-
4 2
-
Sample output
-
6
Combination problem!
AC code:
#include<stdio.h>int C(int m,int n){int cm=1,cn=1,i;for(i=2;i<=n;i++)cn*=i;for(i=m-n+1;i<=m;i++)cm*=i;return cm/cn;}int main(){int m,n;while(~scanf("%d%d",&m,&n)){int res=1;while((m/n)>1){res=res*C(m,n)%2013;m-=n;}printf("%d\n",res);}return 0;}