CodeChef is a non-commercial competitive programming community
Login
Username (New User? Signup) Password (Forgot Password?)
Signup
Login or
Signup with
Connect
Note
  • Publicize your achievements on your Facebook Wall.
  • Challenge your friends or ask them for help.

Site Navigation

  • PRACTICE
    • Easy
    • Medium
    • Hard
    • Challenge
    • Peer
  • COMPETE
    • All Contests
    • June Long 2012
    • May Cook-Off
    • May Long 2012
  • DISCUSS
    • Wiki
    • Forums
    • Blog
    • Facebook
    • Twitter
  • COMMUNITY
    • CodeChef Meetups
    • Campus Chapters
    • Host your Contest
    • User Groups
    • CodeChef TechTalks
    • All Educational Initiatives
    • Event Calendar
  • HELP
    • Frequently Asked Questions
    • FAQ for problem setters
    • Problem Setting
    • Tutorials
    • Long Contest Ranks
    • Short Contest Ranks
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CodeChef Financials
    • CodeChef Sponsorships
    • CEO's Corner
    • Contact Us
    • About Directi
Home » Compete » The January 2011 Cook-Off » Chef team

Chef team

Problem code: CHEFTEAM

  • All Submissions

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


  • Submit

Comments

  • Login or Register to post a comment.

Why should I wait forĀ ages to

pdwd @ 23 Jan 2011 10:19 PM

Why should I wait forĀ ages to get the result...

Getting runtime error. I

sahu_avaya @ 23 Jan 2011 10:23 PM

Getting runtime error. I don't think application can throw any runtime error.

Przemyslaw Derengowski: You

tarun_kumar @ 23 Jan 2011 10:25 PM

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?

sopno @ 23 Jan 2011 10:39 PM

what wilh happened when N<K?

when i submit results..it

dead_coder @ 23 Jan 2011 10:39 PM

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

anton_adm @ 23 Jan 2011 10:52 PM

to ghumanto balok

Try to think logically.

Dont Understand---Tried 2

prince1991 @ 23 Jan 2011 11:36 PM

Dont Understand---Tried 2 approaches--both saying Time Limit Exceeded--Its running pretty fast on my pc

how to solve this problem

yak @ 24 Jan 2011 12:11 AM

how to solve this problem .....?? Any hints getting WA !!

No thinking here, only care

pdwd @ 24 Jan 2011 12:17 AM

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

vfix @ 24 Jan 2011 12:24 AM

@Przemyslaw Derengowski ....i didnt used BigInt (BigInteger.multiply()) to be precise )and thats why got WA :P

@Marek Bardo you can visit

vfix @ 24 Jan 2011 12:38 AM

@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/

vfix @ 24 Jan 2011 12:40 AM

http://www.codechef.com/wiki/january-cookoff-contest-problem-editorials

corrected http://www.codechef

vfix @ 24 Jan 2011 12:42 AM

corrected

http://www.codechef.com/wiki/january-cookoff-contest-problem-editorials

Practice problem page for

ambujpandey @ 24 Jan 2011 01:06 AM

Practice problem page for this showing "Page Not Found".

#include<stdio.h>int

jay123 @ 27 Jan 2011 01:42 AM

#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

warlog @ 30 Jan 2011 06:23 PM

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

SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:

Programming Competition Fetching successful submissions
Directi Go for Gold
CodeChef is a global programming communityCodeChef hosts online programming competitions
CodeChef is a non-commercial competitive programming community
  • About CodeChef
  • About Directi
  • CEO's Corner
  • C-Programming
  • Programming Languages
  • Contact Us
© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs
In order to report copyright violations of any kind, send in an email to copyright@codechef.com
CodeChef a product of Directi
The time now is:
CodeChef - A Platform for Aspiring Programmers

CodeChef was created as a platform to help programmers make it big in the world of computer programming. At CodeChef we work hard to revive the geek in you by hosting programming contests on a monthly basis. We also aim to have training sessions and events related to online programming for programmers around the world. Apart from providing a platform for programming competitions, CodeChef also has various tutorials and forum discussions to help those who are new to the world of computer programming.

Practice Section - A Place to hone your 'Computer Programming Skills'

Try your hand at one of our many practice problems and submit your solution in a language of your choice. Our judge accepts solutions in over 35+ programming languages. Online programming was never this much fun! Receive points, and move up through the CodeChef ranks. Use our practice section to better prepare yourself for the multiple programming competitions that take place through-out the month on CodeChef.

Compete - Monthly Programming Contests and Cook-offs

Here is where you can show off your computer programming skills. Take part in our 10 day long monthly programming contests and the shorter format Cook-off programming contests. Put yourself up for recognition and win great prizes. Prizes worth up to Rs.20,000 and $700 are up for grabs every month along with lots more CodeChef goodies.

Discuss

Are you new to computer programming? Do you need help with algorithms? Then be part of CodeChefs Forums and interact with all our programmers love helping out other programmers and share their ideas.

CodeChef Community

As part of our Educational initiative, we give institutes the opportunity to associate with CodeChef in the form of Campus Chapters. Hosting online programming competitions is not the only feature on CodeChef. Be a part of the CodeChef community through CodeChef meetups and techtalks. You can also host a programming contest for your institute on CodeChef and be a guest author on our blog.

Go For Gold

The Go for Gold Initiative was launched about a year after CodeChef was incepted, to help prepare Indian students for the ACM ICPC World Finals competition. In the run up to the ACM ICPC competition, the Go for Gold initiative uses CodeChef as a platform to train students for the ACM ICPC competition via multiple warm up contests. As an added incentive the Go for Gold initiative is also offering over Rs.8 lacs to the Indian team that beats the 29th position at the ACM ICPC world finals. Find out more about the Go for Gold and the ACM ICPC competition here.

Domain Name Registration, Web hosting, and Website Design provided by BigRock.com