Danganronpa water problem.

Source: Internet
Author: User

Danganronpa

Time limit:2000/1000 MS (java/others) Memory limit:65536/65536 K (java/others)
Total submission (s): 304 Accepted Submission (s): 217


Problem Descriptionchisa Yukizome works as a teacher in the school. She prepares many gifts, which consist ofNKinds witha[i] Quantities of each kind, for she students and wants to the A class meeting. Because of the busy work, she gives his gifts to the monitor, Chiaki Nanami. Due to the strange design of the school, the students ' desks is in a row. Chiaki Nanami wants to arrange gifts like this:

1. Each table would be prepared to a mysterious gift and an ordinary gift.

2. In order to reflect the Chisa yukizome ' s generosity, the kinds of the ordinary gift on the adjacent table must be Diffe Rent.

3. There is no limits for the mysterious gift.

4. The gift must be placed continuously.

She wants to know what many students can get gifts in accordance with her idea at most (suppose the number of students is Infinite). As the most important people of hers, you're easy-to-solve it, aren ' t you?

Inputthe first line of input contains an integerT(t≤ten) indicating the number of test cases.

Each case contains one integerN. The next line containsN(1≤n≤) Numbersa1,a2,.. . ,an , (1≤ai≤100000).

Outputfor each test case, output one line containing ' case #x: Y ' (without quotes), where x is the ' Test Case number (star Ting from 1) and Y are the answer of Chiaki Nanami ' s question.

Sample Input123 2

Sample outputcase #1:2

Authoruestc

SOURCE2016 Chinese College Student Program design contest-Network Tryouts

When the game is water, it is less than the sum = 1 of the situation WA.

Code:

#include <stdio.h>
#include <string.h>
#define N 110000

int main (void)
{
int sum, I, J, T, N;
int a[n];
j = 0;
scanf ("%d", &t);
while (t--)
{
j + +;
sum = 0;
scanf ("%d", &n);

for (i = 0; i < n; i++)
{
scanf ("%d", &a[i]);
Sum + = A[i];

}

if (sum = = 1)
printf ("Case #%d:1\n", j);
Else
printf ("Case #%d:%d\n", J, SUM/2);
}


}

Recommendwange2014 | We have carefully selected several similar problems for you:5842 5841 5840 5839 5838

Danganronpa water problem.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.