QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 33

#14006. Qualification Round

الإحصائيات

You've just advanced from the Qualification Round of Google Code Jam Africa 2010, and you want to know how many of your fellow contestants advanced with you. To give yourself a challenge, you've decided only to look at how many people solved each problem.

The Qualification Round consisted of P problems; the ith problem was fully solved by Si contestants. Contestants had to solve C problems in order to advance to the next round. Your job is to figure out, using only that information, the maximum number of contestants who could have advanced.

Input

The first line of the input gives the number of test cases, T. T lines follow. Each will consist only of space-separated integers: first P, then C, then P integers S0...SP-1.

Output

For each test case, output one line containing "Case #x: y", where x is the case number (starting from 1) and y is the maximum number of contestants who could have advanced (in other words, the maximum number of contestants who could have solved at least C problems).

Limits

  • 1 ≤ T ≤ 100
  • 1 ≤ CP

Small Dataset (11 points)

  • 1 ≤ P ≤ 6
  • 0 ≤ Si ≤ 1000

Large Dataset (22 points)

  • 1 ≤ P ≤ 60
  • 0 ≤ Si ≤ 1017

Example

Input

2
2 2 73 100
3 2 245 272 238

Output

Case #1: 73
Case #2: 377

Discussions

About Discussions

The discussion section is only for posting: Editorials, General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues. Submitting multiple issues may cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.