CF975B.Mancala

普及-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Mancala is a game famous in the Middle East. It is played on a board that consists of 14 holes.

Initially, each hole has aia_i stones. When a player makes a move, he chooses a hole which contains a positive number of stones. He takes all the stones inside it and then redistributes these stones one by one in the next holes in a counter-clockwise direction.

Note that the counter-clockwise order means if the player takes the stones from hole ii, he will put one stone in the (i+1)(i+1)-th hole, then in the (i+2)(i+2)-th, etc. If he puts a stone in the 1414-th hole, the next one will be put in the first hole.

After the move, the player collects all the stones from holes that contain even number of stones. The number of stones collected by player is the score, according to Resli.

Resli is a famous Mancala player. He wants to know the maximum score he can obtain after one move.

曼卡拉(Mancala)是中东地区广为人知的一款游戏,其棋盘由 14 个洞组成。

初始时,第 ii 个洞中有 aia_i 颗石子。当一名玩家进行一次操作时,他需选择一个含有正数颗石子的洞,取走其中全部石子,并将这些石子按逆时针方向依次逐颗分配到后续的洞中。

注意:逆时针顺序意味着,若玩家从第 ii 个洞取走石子,则他先在第 (i+1)(i+1) 个洞放入一颗石子,再在第 (i+2)(i+2) 个洞放入一颗,依此类推;若某颗石子被放入第 1414 个洞,则下一颗石子将放入第 11 个洞。

操作完成后,玩家收集所有含有偶数颗石子的洞中的全部石子。根据 Resli 的规则,玩家所收集的石子总数即为其得分。

Resli 是一位著名的曼卡拉玩家。他希望知道:仅进行一次操作后,所能获得的最高得分是多少?

输入格式

The only line contains 14 integers a1,a2,…,a14a_1, a_2, \ldots, a_{14} (0≤ai≤1090 \leq a_i \leq 10^9) — the number of stones in each hole.

It is guaranteed that for any ii (1≤i≤141\leq i \leq 14) aia_i is either zero or odd, and there is at least one stone in the board.

唯一的一行包含 14 个整数 a1,a2,…,a14a_1, a_2, \ldots, a_{14}(0≤ai≤1090 \leq a_i \leq 10^9)——表示每个洞中的石子数量。

保证对任意 ii(1≤i≤141\leq i \leq 14),aia_i 要么为 0,要么为奇数,且棋盘上至少有一颗石子。

输出格式

Output one integer, the maximum possible score after one move.

输出一个整数,表示进行一次移动后可能得到的最高分数。

输入输出样例

  • 输入#1

    0 1 1 0 0 0 0 0 0 7 0 0 0 0

    输出#1

    4
  • 输入#2

    5 1 1 1 1 0 0 0 0 0 0 0 0 0

    输出#2

    8

说明/提示

In the first test case the board after the move from the hole with 77 stones will look like 1 2 2 0 0 0 0 0 0 0 1 1 1 1. Then the player collects the even numbers and ends up with a score equal to 44.

在第一个测试用例中,从有 77 颗石子的洞移动后,棋盘状态将变为 1 2 2 0 0 0 0 0 0 0 1 1 1 1。随后,玩家收集所有偶数,最终得分等于 44。

输入解题思路,AI测评打分。不知道怎么写?

首页