Chef teamProblem code: CHEFTEAM |
All submissions for this problem are available.
Chef has N subordinates. In order to complete a very important order he will choose exactly K of them. He can't choose less than K since it will be not enough to complete the order in time. On the other hand if he chooses more than K subordinates he can't control them during the operation. Help him to find the number of ways he can choose the team to complete this very important order.
Input
The first line contains a single positive integer T <= 100, the number of test cases. T test cases follow. The only line of each test case contains two integers N and K, where 0 <= N, K < 2^64. It is guaranteed that the answer will be less than 2^64.
Output
For each test case, output a single line containing the number of ways to choose the required team.
Example
Input: 3 2 1 3 3 10 5 Output: 2 1 252
| Author: | anton_lunyov |
| Date Added: | 14-01-2011 |
| Time Limit: | 1 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC |
Comments

Fetching successful submissions

Why should I wait forĀ ages to
Why should I wait forĀ ages to get the result...
Getting runtime error. I
Getting runtime error. I don't think application can throw any runtime error.
Przemyslaw Derengowski: You
Przemyslaw Derengowski: You don't have to wait for ages unless your age is less than 2.5 hrs :)
what wilh happened when N<K?
what wilh happened when N<K?
when i submit results..it
when i submit results..it shows running for couple of minutes and then says TLE..Its running pretty fast on my pc!!
to ghumanto balok Try to
to ghumanto balok
Try to think logically.
Dont Understand---Tried 2
Dont Understand---Tried 2 approaches--both saying Time Limit Exceeded--Its running pretty fast on my pc
how to solve this problem
how to solve this problem .....?? Any hints getting WA !!
No thinking here, only care
No thinking here, only care about not exceeding 2^64 - I used bigint... I dont like this problem at all, I wasted a lot of time on it and lacked 5 minutes to get third task...
@Przemyslaw Derengowski ....i
@Przemyslaw Derengowski ....i didnt used BigInt (BigInteger.multiply()) to be precise )and thats why got WA :P
@Marek Bardo you can visit
@Marek Bardo
you can visit the editorial page where you can get correct approach and you can view probelm setter's and tester's solution if you want to view the solution.
http://www.codechef.com/wiki/january-cookoff-contest-problem-editorials
http://www.codechef.com/wiki/
http://www.codechef.com/wiki/january-cookoff-contest-problem-editorials
corrected http://www.codechef
corrected
http://www.codechef.com/wiki/january-cookoff-contest-problem-editorials
Practice problem page for
Practice problem page for this showing "Page Not Found".
#include<stdio.h>int
#include<stdio.h>
int main()
{
int testcase;
int n,k;
int i;
float result=1.0f;
scanf("%d",&testcase);
while(testcase)
{
scanf("%d%d",&n,&k);
for(i=0;i<k;i++)
{
result=result*((float)(n-i)/(float)(i+1));
printf("%d",(int)result);
}
printf("%d",(int)result);
testcase--;
}
return 0;
}
Sample input: 1 5 0 1 0 1
Sample input:
1
5
0 1 0 1 3
What should be the output?
Output1: 2 1 5 4 3
Output2: 3 1 5 4 2