首页 > 其他分享 >G - MaratonIME does a competition

G - MaratonIME does a competition

时间:2023-05-25 10:08:02浏览次数:48  
标签:students team problems competition does Renzo contestant MaratonIME


Statements

It's January and MaratonIME is attending to an ACM-ICPC Summer School in Campinas. Renzo, THE POWERFUL, went to visit his students and, as usual, brought chocolates from Peru. However, after a couple of parties, MaratonIME is growing a lot and Renzo doesn't have enough chocolates for everyone.

There is enough chocolate for  of the students. So, Renzo will reward the best contestants. As a great coach, Renzo wants MaratonIME to work as a team, so he divided the students in 4 teams, , ,  and . The team which solves more problems wins. If two teams manage to solve the same amount of problems, Renzo rewards the team with smaller lexicographical name (if  and  draw,  gets the chocolates).

In order to assign participants to teams, Renzo found out the amount n of contestants and gave each one of them a different integer from 1 to n. Having numbered the students, Renzo decided that the one with number 1 would go to team , the one with number 2 would go to team  and so on. Formally:

  • The contestant with number 1 is on team 
  • If 1 < i + 1 ≤ n and contestant i is on , then contestant i + 1 is on team 
  • If 1 < i + 1 ≤ n and contestant i is on , then contestant i + 1 is on team 
  • If 1 < i + 1 ≤ n and contestant i is on , then contestant i + 1 is on team 
  • If 1 < i + 1 ≤ n and contestant i is on , then contestant i + 1 is on team 

There are many students and Renzo is busy thinking about the next contest he's creating, so you were chosen to determine which team wins the big prize! You are given a vector a of size n where, for each index 1 ≤ i ≤ nai is the amount of problems solved by contestant i during the contest. The amount of problems solved by a team is the sum of the problems solved by it's contestants.

Input

The first line of input has an integer 4 ≤ n ≤ 105. The second line, n integers 0 ≤ ai ≤ 104.

Output

You should print one line with name of the team that gets the chocolates: , ,  or .

Example

Input


4 1 2 3 4


Output


D


题目大意及思路:给你N个数,第一个数去1队,第二个数去2队,第三个数去3队,第4个数去4队,以此类推。最后那个队伍的和最多,输出相对应的ABCD

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int n, sum1, sum2, sum3, sum4, i;
    int a[100100];
    int b[101];
    sum1 = sum2 = sum3 = sum4 = 0;
    scanf("%d", &n);
    for(i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        if(i % 4 == 1)
        {
            sum1 = sum1 + a[i];
        }
        if(i % 4 == 2)
        {
            sum2 = sum2 + a[i];
        }
        if(i % 4 == 3)
        {
            sum3 = sum3 + a[i];
        }
        if(i % 4 == 0)
        {
            sum4 = sum4 + a[i];
        }
    }
    int max = sum1;
    b[1] = sum1;
    b[2] = sum2;
    b[3] = sum3;
    b[4] = sum4;
    for(i = 1; i <= 4; i++)
    {
        if(b[i] > max)
        {
            max = b[i];
        }
    }
    for(i = 1; i <= 4; i++)
    {
        if(b[i] == max)
        {
            break;
        }
    }
    if(i == 1)
    {
        printf("A\n");
    }
    if(i == 2)
    {
        printf("B\n");
    }
    if(i == 3)
    {
        printf("C\n");
    }
    if(i == 4)
    {
        printf("D\n");
    }
    return 0;
}

 

标签:students,team,problems,competition,does,Renzo,contestant,MaratonIME
From: https://blog.51cto.com/u_16127529/6345035

相关文章