-
Notifications
You must be signed in to change notification settings - Fork 0
/
judges_score_problem.py
50 lines (39 loc) · 1.71 KB
/
judges_score_problem.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# PROBLEM STATEMENT
# Stage: https://www.hackerearth.com
# Harry was contesting to be the most stylist person in his college. He had to collect maximum points from the judges to be able to win. However there was a problem. The judges were sitting in a line and each pair of adjacent judges had ego issues with each other. So if one judge gave X points to Harry then the next judge won’t give him any points. Harry had a friend in the organizing team and through him he had found out the exact points he would get from each judge if he chose their score to be considered. Help him find out the maximum points he can score.
# INPUT
# The first line of input contains the number of test cases, T.
# 0 < T < = 10
# Each test case starts with a number N, the number of judges.
# 0 <= N < = 10^4.
# The next line will have N numbers, number of points each judge gave Harry
# 0 < = X(i) < = 10^9.
# The order of the judges does not change.
# OUTPUT
# For each test case print “Case T: A” without quotes in a single line.
# T is the case number, starting with 1.
# A is the maximum number of points Harry can collect.
# SAMPLE INPUT:
# 2
# 5
# 1 2 3 4 5
# 1
# 10
# SAMPLE OUTPUT:
# Case 1: 9
# Case 2: 10
# CUSTOM TestCase I/P:
#
Max_Scores = []
rounds = int(input())
for i in range(rounds):
no_of_judges = int(input())
score_of_all_judges = a = [int(x) for x in input().split()]
sum1 = sum(score_of_all_judges[::2]) # Calculate the score of even seated judges
sum2 = sum(score_of_all_judges[1::2]) # Calculate the score of even seated judges
if sum1 > sum2:
Max_Scores.append(sum1)
else:
Max_Scores.append(sum2)
for i in range(len(Max_Scores)):
print("Case {}: {}".format(i+1, Max_Scores[i]))