305116: CF975B. Mancala
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Mancala
题意翻译
## 题目描述 在外国有一种棋,这种棋在一个有 $14$ 个孔的棋盘上玩。一开始,每个洞有 $a_i$ 个石头。当玩家操作的时候,他会选择一个石头个数为正整数的孔并把所有石头都放到这个孔里,然后逆时针把这些石头一个一个地重新分配到下一个洞里方向。逆时针方向的意思是:玩家将在第 $(i+1)$ 、第 $(i+2) \dots$ 个孔依次放入一块石头。如果玩家将一块石头放入第 $14$ 个孔,则下一个要放在第 $1$ 个孔里面。在操作之后,玩家将从包含偶数个石头的洞里收集所有的石头,收集的石头数就是得分。请问一次移动后得到的最高分数是多少? ## 输入格式 一行并且仅有 $14$ 个整数 $a_1,a_2,a_3, \dots,a_{14}$ 表示每个孔里面石头的初始数量。 保证对于任意的 $i$ ( $1 \leq i \leq 14$ ) ,满足 $a_i$ 不是 $0$ 就是奇数,且棋盘上至少有一块石头。 ## 输出格式 输出一个整数,一次移动后的最大可能分数。题目描述
Mancala is a game famous in the Middle East. It is played on a board that consists of 14 holes. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF975B/b616fc11c80b3d706df3acbd4a36464b885f1594.png)Initially, each hole has $ a_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 $ i $ , he will put one stone in the $ (i+1) $ -th hole, then in the $ (i+2) $ -th, etc. If he puts a stone in the $ 14 $ -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.输入输出格式
输入格式
The only line contains 14 integers $ a_1, a_2, \ldots, a_{14} $ ( $ 0 \leq a_i \leq 10^9 $ ) — the number of stones in each hole. It is guaranteed that for any $ i $ ( $ 1\leq i \leq 14 $ ) $ a_i $ is either zero or odd, and there is at least one stone in the board.
输出格式
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