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 ...
随机推荐
- Docker容器的数据卷(data volume),数据卷容器,数据卷的备份和还原。
Docker容器的数据卷(data volume),数据卷容器,数据卷的备份和还原. 数据卷就是数据(一个文件或者文件夹). Docker的理念之一是将应用与其运行的环境打包,docker容器的生命周 ...
- JTLParser-linux上jmeter的jtl文件二次分析
解析JMeter的JTL文件 2013年01月30日 ⁄ 综合 ⁄ 共 1452字 ⁄ 字号 小 中 大 ⁄ 评论关闭 http://code.google.com/p/xtoolkit/wiki ...
- leeetcode 735. Asteroid Collision
We are given an array asteroids of integers representing asteroids in a row. For each asteroid, the ...
- LightOJ - 1104 Birthday Paradox —— 概率
题目链接:https://vjudge.net/problem/LightOJ-1104 1104 - Birthday Paradox PDF (English) Statistics For ...
- Java JSON数据创建和读取
Java json数据创建 package com.JavaTest; import com.google.gson.JsonArray; import com.google.gson.JsonOb ...
- c++变量定义
float **a 表示a是一个“指针的指针”,也可以理解为是一个二维数组的指针,***a具有类似的解释,可以理解为是一个三维数组的指针.
- BZOJ 1633 [Usaco2007 Feb]The Cow Lexicon 牛的词典:dp【删字符最少】
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1633 题意: 给你一个长度为n的主串a,和一个有m个字符串s[i]的单词书(s[i].si ...
- 004 - 修改Pycharm默认启动打开最近的项目
随着项目的增多, 可能会使用到不同的项目, 而有的时候我们导入项目到新一个窗口中之后, 下一次打开Pycharm就变成之前导入的那个项目了 那么之前我们的项目怎么找到呢? 修改一下Pycharm启动默 ...
- 机器学习之逻辑回归(logistic回归)
前言 以下内容是个人学习之后的感悟,转载请注明出处~ 逻辑回归 一.为什么使用logistic回归 一般来说,回归不用在分类问题上,因为回归是连续型模型,而且受噪声影响比较大 ...
- Prime Independence
题意: 对于给定集合,求解最大的子集合,使得集合内两两之商不为质数. 解法: 考虑对于每一个数字分解质因数可以得到 $O(nloglogNUM)$ 条两个数字不可以出现在同一集合的信息. 同时发现一条 ...