B. Mancala (Codeforces Round #478 (Div. 2))
#include <bits/stdc++.h>
using namespace std;
const int maxn = ;
typedef long long ll;
ll a[maxn];
ll b[maxn]; int main(){
for(int i = ;i < maxn;i++){
cin >> a[i];
}
ll ans = -;
for(int i = ;i < maxn;i++){
for(int j = ;j < maxn;j++) b[j] = a[j];
b[i] = ;
int x = a[i] / maxn;
int y = a[i] % maxn;
for(int j = ;j < maxn;j++)
b[j] += x;
for(int j = ;j <= y;j++)
b[(j+i)%maxn]++;
ll sum = ;
for(int j = ;j < maxn;j++)
if(b[j]% == )
sum += b[j];
if(ans < sum)
ans = sum;
}
cout << ans << endl;
return ;
}
B. Mancala
B. Mancala (Codeforces Round #478 (Div. 2))的更多相关文章
- Codeforces Round #478 (Div. 2)
题目链接:http://codeforces.com/contest/975 A. Aramic script time limit per test:1 second memory limit pe ...
- Codeforces Round #478 (Div. 2) ABCDE
A. Aramic script time limit per test 1 second memory limit per test 256 megabytes input standard inp ...
- 【map离散&容斥】Ghosts @Codeforces Round #478 (Div. 2) D
传送门 题意:给你一条直线的斜率a和截距b,和某一时刻n个在直线上的点的横坐标,以及沿坐标轴方向的速度.问你这些点在(-∞,+∞)的时间内的碰撞次数. solution 设两个点在t时刻相碰,有: x ...
- 【推导】Codeforces Round #478 (Div. 2) D. Ghosts
题意:给你一条直线以及初始时刻这条直线上的一些人的坐标,以及他们的速度矢量.让你对每个人计算他在过去无限远到将来无限远的时间内会与多少人处于同一个点,然后对每个人的这个值求和. 列方程组:两个人i,j ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- Codeforces Round #279 (Div. 2) ABCDE
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems # Name A Team Olympiad standard input/outpu ...
随机推荐
- Android开发之onMeasure(int widthMeasureSpec, int heightMeasureSpec)方法
onMeasure()函数由包含这个View的具体的ViewGroup调用,因此值也是由其ViewGroup中传入的.子类View的这两个参数widthMeasureSpec, heightMeasu ...
- uni-app 创建的第一个应用
本人微信公众号:前端修炼之路,欢迎关注 背景介绍 经过上一篇文章uni-app官方教程学习手记的学习之后,我就着手做这个项目了. 目前已经初步搭出了整体的框架,秉着取之于社会,回馈于社会的原则,我将这 ...
- 在dw中 <!----> 和 /**/ 的区别?
<!-- -->是HTML的注释标签,使用<和>是符合HTML标签语法规则的./* */是CSS和JS的注释标签.两种注释有各自的使用环境,并且不能相互替代.
- 快速上手Ubuntu之安装篇——安装win7,Ubuntu16.04双系统【转】
本文转载自:http://blog.csdn.net/qq_28205153/article/details/52203512 Linux可以说是开发者的系统,对于开发者来说,Linux发行版不仅为我 ...
- 如何把wecenter的推荐的问题模块单独调取出来?
查阅文档: http://wenda.wecenter.com/question/1893 http://www.zhidiu.com/article/1012 http://wenda.wecent ...
- ansible 魔法变量
hostvars 可以让你调用其他host的变量和facts, 即使你没有在这个机器上执行过playbook, 你仍然可以访问变量, 但是不能访问facts. 例如: {{ hostvars['te ...
- 解决js 运算 精度缺失
github地址: https://github.com/MikeMcl/big.js
- dos窗口的乱码问题
1.在dos窗口上输入chcp 65001 2.然后右键属性选择字体
- shell json简单处理
- StarUML中时序图
StarUML中时序图 在看时序图的例子的时候,发现有些的时序图上有小人的图标,可是一些UML工具却没有找到小人的图标,这让我很闹心,一直没解决,今天终于将该问题给解决了.解决这个问题来自于网上的一个 ...