G - MaratonIME does a competition

简介: G - MaratonIME does a competition

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 ≤ n, ai 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;
}


相关文章
|
机器学习/深度学习 存储 自然语言处理
《a gift from knowledge distillation》
翻译:《a gift from knowledge distillation》
|
Python
lecture 1 练习
Assume that two variables, varA and varB, are assigned values, either numbers or strings.
1095 0
|
资源调度
(zhuan) Evolution Strategies as a Scalable Alternative to Reinforcement Learning
Evolution Strategies as a Scalable Alternative to Reinforcement Learning this blog from: https://blog.
(zhuan) Notes on Representation Learning
this blog from: https://opendatascience.com/blog/notes-on-representation-learning-1/   Notes on Representation Learning By Zac Kriegman, Senior D...
2015 Multi-University Training Contest 1 - 1009 Annoying problem
 Annoying problem Problem's Link:  http://acm.hdu.edu.cn/showproblem.php?pid=5296     Mean:  给你一个有根树和一个节点集合S,初始S为空,有q个操作,每个操作要么从树中选一个结点加入到S中(不删除树中节点),要么从S集合中删除一个结点。
832 0
[Everyday Mathematics]20150220
试求 $$\bex \sum_{k=0}^\infty\frac{1}{(4k+1)(4k+2)(4k+3)(4k+4)}. \eex$$
508 0
[Everyday Mathematics]20150206
$$\bex \sen{fg}_{L^1}\leq C\sen{f}_{L^{r,\al}}\sen{g}_{L^{r',\al'}}, \eex$$ 其中 $$\bex f\in L^{r,\al},\quad g\in L^{r',\al'},\quad \frac{1}{r}+\frac{1}...
483 0