Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Signup
Login or
Signup with
Have you tried CodeChefs "Code, Compile & Run" Its pretty cool. Try it out by pressing Ctrl+;
and
[X]
typing "ide"
PRACTICE
COMPETE
DISCUSS
COMMUNITY
HELP
ABOUT
ALL SUBMISSIONS
SUBMIT
SUCCESSFUL SUBMISSIONS
Time Mem
Lang
Solution
Problem Statement
f03nix
0.00 2.7M
C++ 4.3.2
View
Chef studies combinatorics. He tries to group objects by their rang (a positive integer associated with
each object). He also gives the formula for calculating the number of different objects with rang N as
following:
mpthegreat_5
0.00 2.7M
C++ 4.3.2
View
ellg13
0.00 2.7M
C++ 4.3.2
View
vijay_pal
0.00 2.7M
C++ 4.3.2
View
jaimanoj
0.00 2.7M
C++ 4.3.2
View
architkhosla
0.00 2.7M
C++ 4.3.2
View
ashwin1907
0.00 2.7M
C++ 4.3.2
View
0.00 2.7M
C++ 4.3.2
View
0.00 2.7M
C++ 4.3.2
View
0.00 2.7M
C++ 4.3.2
View
idatarm
0.00 2.7M
C++ 4.3.2
View
sakib_rulez
0.00 2.8M
C++ 4.3.2
View
Input
The first line of the input contains an integer T denoting the number of test cases. The description of T code_note
test cases follows.
na205
The first line of each test case contains four integers A0, A1, A2, A3. The second line contains an integer
S.
usaxena95
Output
For each test case, output a single line containing a single integer - the answer to the test case modulo
1,000,000,007.
Constraints
1 T 500
1 S 100
0 Ai 1000
Sum of all S for all test cases is not greater than 500. It's guaranteed that at least one Ai is nonzero.
1 of 7
HELP
Example
Input:
4
1000
1
1000
3
0100
2
2314
10
Output:
1
3
3
213986343
Explanation
Example case 2.
In the second example function looks as follows F(N) = 1. So for each rang there is a single object of the
rang. To get multiset with sum of rangs equal to 3, you can pick: three objects of rang 1, or one object of
rang 1 and one of rang 2, or only one object of rang 3.
Example case 3.
converted by W eb2PDFConvert.com
In the third example function looks as follows F(N) = N. So, you have one distinct object of rang 1, two
distinct objects of rang 2, three distinct objects of rang 3 and so on. To get
multiset with sum of rangs equal to 2, you can pick: two objects of rang 1, one of objects of rang 2 (two
ways).
Author:
gerald
Tester:
rustinpiece
Editorial
http://discuss.codechef.com/problems/GERALD05
1 sec
Source
Limit:
50000 Bytes
ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 4.8.1, CPP11,
Languages: CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA,
NEM, NICE, NODEJS, 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
Compilation Error
Your code was unable to
compile. When you see this icon, click on it for more
information.
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
converted by W eb2PDFConvert.com
CodeChef was created as a platform to help programmers make it big in the world of algorithms, computer programming and programming contests. At CodeChef we work hard to
revive the geek in you by hosting a programming contest at the start of the month and another smaller programming challenge in the middle of the month. We also aim to have
training sessions and discussions related to algorithms, binary search, technicalities like array size and the likes. Apart from providing a platform for programming competitions,
CodeChef also has various algorithm tutorials and forum discussions to help those who are new to the world of computer programming.
Discuss
Are you new to computer programming? Do you need help with algorithms? Then be a part of CodeChef's Forums and interact with all our programmers - they love helping out other
programmers and sharing their ideas. Have discussions around binary search, array size, branch-and-bound, Dijkstra's algorithm, Encryption algorithm and more by visiting the
CodeChef Forums and Wiki section.
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. You can also host a coding contest for your institute on CodeChef, organize an algorithm event 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.
converted by W eb2PDFConvert.com