#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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. Codeforces 599D Spongebob and Squares(数学)

    D. Spongebob and Squares Spongebob is already tired trying to reason his weird actions and calculati ...

  6. codeforces 610B

    Description Vika has n jars with paints of distinct colors. All the jars are numbered from 1 to n an ...

  7. codeforces 314E Sereja and Squares

    discription Sereja painted n points on the plane, point number i (1 ≤ i ≤ n) has coordinates (i, 0). ...

  8. Codeforces 994 C - Two Squares

    C - Two Squares 思路: 点积叉积应用 代码: #include<bits/stdc++.h> using namespace std; #define fi first # ...

  9. codeforces 425D Sereja and Squares n个点构成多少个正方形

    输入n个点,问可以构成多少个正方形.n,xi,yi<=100,000. 刚看题的时候感觉好像以前见过╮(╯▽╰)╭最近越来越觉得以前见过的题偶尔就出现类似的,可是以前不努力啊,没做出来的没认真研 ...

随机推荐

  1. input内文字点击消失 弹出层,可以写表单

    <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...

  2. linux视频学习3(shell和网络)

    1.shell的学习. shell的种类比较多,主要有三种: /bin/sh, /bin/csh, /bin/ksh. 查看当前使用的是哪种shell : 命令env (显示当前操作系统的环境变量). ...

  3. SqlServer 查询死锁,杀死死锁进程

    -- 查询死锁 select request_session_id spid, OBJECT_NAME(resource_associated_entity_id) tableName from sy ...

  4. svn删除用户

    如果安装有svn客户端,右键打开svn settings 然后就可以重新登录svn用户了 或者删除此文件

  5. 使用Theos做一个简单的Mobile Substrate Tweak

    01 January 2014 Mobile Substrate和Theos Mobile Substrate是Cydia的作者Jay Freeman (@saurik)的另外一个牛X的作品,也叫Cy ...

  6. JS的className,字体放大缩小

    <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...

  7. java 基础之概念

    1:栈(Stack) 先进后出(邮政模拟例) 2:队列(Queue) 先进先出(排队购票)

  8. 河南多校大一训练赛 G 硬币

    题目链接:http://acm.hust.edu.cn/vjudge/contest/125004#problem/G 密码:acm Description 宇航员Bob有一天来到火星上,他有收集硬币 ...

  9. Chapter 1 First Sight——20

    After two classes, I started to recognize several of the faces in each class. 两节课之后,我开始记住了每节课的那几张脸. ...

  10. 2015十大顶级开源ERP系统点评

    如今,企业资源规划(ERP)和客户关系管理(CRM)系统的必要性已经被各种组织和企业所认可:ERP和CRM能够直接为企业的业务效率和利润做出贡献. 但是随着今天企业商业形态的日趋多样化,互联网新经济的 ...