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
    • February CookOff
    • February Long Contest
    • January CookOff
  • DISCUSS
    • Wiki
    • Forums
    • Blog
    • 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
    • Ranks
    • Tutorials
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CodeChef Financials
    • CodeChef Sponsorships
    • CEO's Corner
    • Contact Us
    • About Directi
Home » Compete » September 2010 Challenge » Bytelandian Shoppers

Bytelandian Shoppers

Problem code: BYTESHOP

  • All Submissions

All submissions for this problem are available.

There are N shoppers today at the Bytelandian Shopping Mall. There are M different items at sale at the mall. In how many ways can shoppers purchase R items in all such that everyone buys atleast one item, and every item is brought by atleast one person ? A shopper can purchase any particular item at most once.

Input :
The first line contains the number of test cases T. T lines follow containing 3 integers: N,M and R. 
(1 <= T <= 100. 1 <= N,M <= 200. 1 <= R <= N * M)

Output :
Output T lines, one for each test case, containing the output for the corresponding test case.
Output all values modulo 1000000007

Sample Input :
3
1 1 1
2 1 1
2 3 3

Sample Output :
1
0
6

Date: 2010-08-19
Time limit: 1s
Source limit: 50000
Languages: C C99 strict C++ 4.0.0-8 C++ 4.3.2 PAS gpc PAS fpc JAVA NICE JAR C#2 NEM ST ASM D FORT ADA BASH PERL PYTH RUBY LUA ICON PIKE PHP SCM guile SCM qobi LISP sbcl LISP clisp SCALA HASK ERL CAML CLPS PRLG WSPC BF ICK JS


  • Submit

Comments

  • Login or Register to post a comment.

A nice combinatorial problem!

goharshady @ 1 Sep 2010 05:39 PM

A nice combinatorial problem!

:D:D:D

olympiad @ 1 Sep 2010 10:56 PM

:D:D:D

what does the line Output

eddie @ 2 Sep 2010 07:28 AM

what does the line

Output all values modulo 1000000007
means...

http://en.wikipedia.org/wiki/

triplem @ 2 Sep 2010 10:42 AM

http://en.wikipedia.org/wiki/Modulo_operation

hi! can anybody give the

ashish.pant @ 2 Sep 2010 05:46 PM

hi! can anybody give the complexity of this problem.

i have thought of a N^3 solution. which i think will time out.

i just want to be sure if there exists a (N^2 lg N) solution or we need to optimize N^3 solution.

@ashish: You are not allowed

admin @ 2 Sep 2010 07:57 PM

@ashish: You are not allowed to discuss the complexity of the solution during the contest. Complexity hints at the solution and this is against the rules of the contest.

"every item is brought by

ishandutta2007 @ 2 Sep 2010 10:33 PM

"every item is brought by atleast one person".How can one single item be bought by more than one person simultaneously?Does it mean that there is an infinite number of items of each type;differnt users buy differents copies of item of same kind?In that case "There are M different items" should mean that there are M kinds of items.

@ishan dutta As far as I

burdakovd @ 4 Sep 2010 01:40 PM

@ishan dutta

As far as I understand, there are M types of items at sale.

"every item is brought by atleast one person" means that at least one instance of every type must be sold.

"A shopper can purchase any particular item at most once." means that every buyer will by at most one instance of every item type.

 

I hope somebody will corect if this interpretation is wrong.


And "purchase R items" means

burdakovd @ 4 Sep 2010 01:42 PM

And "purchase R items" means purchase R instances of items.

everything is right than why

moniv9 @ 5 Sep 2010 04:51 AM

everything is right than why runtime error is coming.......

@Mohit If you get a runtime

anshuman_singh @ 5 Sep 2010 09:02 AM

@Mohit If you get a runtime error, then that means that everything is not right

@Burdakov Daniel. I

ishandutta2007 @ 5 Sep 2010 10:52 AM

@Burdakov Daniel. I understand what the problem tries to mean but the language the writer wrote it in makes thinks unclear.No where in the problem statement the phrase "type of item" or "kind of item" is used. it just vagely refers R as well as M as the number of items.

Please Do give some more

moniv9 @ 6 Sep 2010 01:13 AM

Please Do give some more input/output samples becoz it is very difficult to trace problem in our program when it is running fine on our computer..............but not on your compiler

That's why this is a contest.

triplem @ 6 Sep 2010 02:36 AM

That's why this is a contest. You're expected to do the hard work, not other people.

A very crisp & beautiful

yellow_agony @ 6 Sep 2010 11:32 PM

A very crisp & beautiful problem :)

From editorial: "The final

thocevar @ 11 Sep 2010 04:49 PM

From editorial: "The final answer is given by summing G(i,j) over all (i,j). We add G(i,j) to the answer if (i + j) is even, else we subtract it."

Can someone please explain why this works?

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.

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