시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
4 초 | 256 MB | 49 | 25 | 17 | 43.590% |
A university gives scholarship to students based on their current CGPA. This waiver allocation follows some rules. At the beginning of a semester allotted scholarships for certain CGPA range is put on the notice board in tabular form. Two such tables are shown below:
In the table on the left it is said that students who have CGPA within 3.60 and 3.69 (inclusive) will get 10% of their tuition fee as scholarship. Similarly, those with CGPA range is within 3.90-3.99 will get 40% of their tuition fee as scholarship. Using the two tables above we will try to explain to you the rules and restrictions of allocating waiver:
Given the number of students, total available scholarship units and their current CGPA, your job is to find out the number of different possible scholarship allocations that uses up all the scholarship units. Two scholarship allocations are different if their CGPA range is different or scholarship allocation in any slab is different.
Input file contains at most 100 sets of inputs. The description of each set is given below:
Each set starts with two integers N (N<=10000) which indicates the total number of students and P which indicates the scholarship units that needs to be used up. Each of the next N lines contains the CGPA of one student.
Input is terminated by a line containing two zeroes.
For each test case produce one line of output which contains an integer D. This D denotes the total number of different scholarship allocations that uses up all P units. Input will be such that there will always be at least one possible allocation.
10 410 3.29 3.96 2.61 2.82 3.93 3.68 3.70 2.91 3.28 3.68 0 0
79554
//a = 10 d = 10 lowest = 2.88 nslab = 8 wslab = 14
One possible solution to the sample input above is
CGPARange | # of students | Waiver % | Total Units needed |
---|---|---|---|
3.93-4.00 | 2 | 80 | 160 |
3.78-3.92 | 0 | 70 | |
3.63-3.77 | 3 | 60 | 180 |
3.48-3.62 | 0 | 50 | |
3.33-3.47 | 0 | 40 | |
3.18-3.32 | 2 | 30 | 60 |
3.03-3.17 | 0 | 20 | |
2.88-3.02 | 1 | 10 | 10 |
Total Units | 410 |
There is another 79553 different allocation which uses up all 410 units exactly.