CodeForces 610B Vika and Squares
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std; const int maxn=+;
long long a[maxn],n;
long long Min;
long long ans;
long long b[maxn]; int main()
{
while(~scanf("%lld",&n)){
Min=;
for(long long i=;i<=n;i++) scanf("%lld",&a[i]);
for(long long i=;i<=n;i++) if(a[i]<Min) Min=a[i];
int tot=;
for(long long i=;i<=n;i++) if(a[i]==Min) b[tot++]=i;
ans=-;
for(int i=;i<tot;i++)
{
if(i<tot-)
{
long long ans2=(Min)*(n-b[i+]++b[i])+(Min+)*(b[i+]-b[i]-);
ans=max(ans,ans2);
}
else if(i==tot-)
{
long long ans2=(Min+)*(n-b[i]+b[]-)+Min*(b[i]-b[]+);
ans=max(ans,ans2);
}
}
printf("%lld\n",ans);
}
return ;
}
CodeForces 610B Vika and Squares的更多相关文章
- Codeforces Round #337 (Div. 2) 610B Vika and Squares(脑洞)
B. Vika and Squares time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #337 (Div. 2) B. Vika and Squares 贪心
B. Vika and Squares 题目连接: http://www.codeforces.com/contest/610/problem/B Description Vika has n jar ...
- Codeforces Round #337 (Div. 2) B. Vika and Squares 水题
B. Vika and Squares Vika has n jars with paints of distinct colors. All the jars are numbered from ...
- Codeforces Round #337 (Div. 2) B. Vika and Squares
B. Vika and Squares time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces 599D Spongebob and Squares(数学)
D. Spongebob and Squares Spongebob is already tired trying to reason his weird actions and calculati ...
- codeforces 610B
Description Vika has n jars with paints of distinct colors. All the jars are numbered from 1 to n an ...
- codeforces 314E Sereja and Squares
discription Sereja painted n points on the plane, point number i (1 ≤ i ≤ n) has coordinates (i, 0). ...
- Codeforces 994 C - Two Squares
C - Two Squares 思路: 点积叉积应用 代码: #include<bits/stdc++.h> using namespace std; #define fi first # ...
- codeforces 425D Sereja and Squares n个点构成多少个正方形
输入n个点,问可以构成多少个正方形.n,xi,yi<=100,000. 刚看题的时候感觉好像以前见过╮(╯▽╰)╭最近越来越觉得以前见过的题偶尔就出现类似的,可是以前不努力啊,没做出来的没认真研 ...
随机推荐
- Ansible1:简介与基本安装【转】
Ansible是一个综合的强大的管理工具,他可以对多台主机安装操作系统,并为这些主机安装不同的应用程序,也可以通知指挥这些主机完成不同的任务.查看多台主机的各种信息的状态等,ansible都可以通过模 ...
- SVN和GIT的使用
一.SVN通用流程 1.从服务器仓库的项目上右键拷贝项目地址,然后来到你的电脑桌面上右键“SVN checkout...”,这样就跟服务器建立了关联 2.如果有创建新文件,则右键选择“Tortoise ...
- Qt之日志输出窗口
来源:http://blog.sina.com.cn/s/blog_a6fb6cc90101guz0.html 继上节所讲,Qt可以很容易的将一些日志信息保存到文件中,那么日志信息如何输出到窗口呢? ...
- MySQL 异常错误码使用 及 对照表
DECLARE CONTINUE HANDLER FOR SQLWARNING, SQLEXCEPTION, NOT FOUND BEGIN GET DIAGNOSTICS CONDITION cod ...
- EditText的一点深入的了解
最近在开发android下的记事本程序时,频繁的使用EditText控件,折腾来折腾去,算是对其的了解更深入了一些.特将这些收获记录如下: 一.几个属性的介绍 android:gravity=&quo ...
- android执行外部命令、检测文件是否存在、自动检测U盘路径
private final String UDiskFileName = "/2969_logo/bootfile.image"; private final String Loc ...
- Ubuntu不可以ping百度,但是可以ping通其ip
原来也安装过几个ubuntu系统,但是今天遇到一个很奇怪的情况,明明ifconfig显示已经获取了网络上的ip,但是浏览器就是打不开网页,百思不得其解.因为这几天用ping用多了,所以进行了以下尝试: ...
- img图片inline-block总结
<div style="font-size:0;"> <img data-src="http://image.zhangxinxu.com/image/ ...
- HDU2579--Dating with girls(2)--(DFS, 判重)
Dating with girls(2) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Oth ...
- climit 头文件的内容
int.long和long long C++的short.int.long和long long类型通过使用不同数目的位来存储值(关于位的概念自行了解),最多能够表示4中不同的整数宽度.C++提供了一种 ...