F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Stone

Time Limit: 3000/2000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others)
Total Submission(s): 2838    Accepted Submission(s): 740


Problem Description
Given an array of integers {xi}. Each time you can apply one of the following operations to the array:
1. Choose an integer x from the array, replace it with x+1.
2. Add a new integer 1 to the array.

Define p as the product of all integers in the set. i.e. p=x1*x2*x3*...
What's the maximum possible value of p after exactly M operations?
 

Input
First line is a integer T (T ¡Ü 100), the number of test cases.
The first line of each test case contains two integers N and M, the number of integers in the initial set, and the number of operations.
The second line is N integers xi initially in the set.
1 ¡Ü N ¡Ü 100000
0 ¡Ü M ¡Ü 10^18
-10000 ¡Ü xi ¡Ü 10000
 

Output
For each case, you should output ¡°Case k: ¡± first, where k indicates the case number and counts from one. Then the maximum product mod 1000000007.
 

Sample Input
4 1 1 5 3 2 1 2 3 3 2 -1 2 3 3 1 -3 -3 -3
 

Sample Output
Case 1: 6 Case 2: 18 Case 3: 6 Case 4: -18
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 08:58:12, Gzip enabled