#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. oc唯一标时一部设备

    ios7之前可以使用mac地址 ios7之后首先创建两个类 #import MyKeyChainManager.h @implementation MyKeyChainManager : NSObje ...

  2. 严格递增类的dp Codeforces Round #371 (Div. 1) C dp

    http://codeforces.com/contest/713 题目大意:给你一个长度为n的数组,每次有+1和-1操作,在该操作下把该数组变成严格递增所需要的最小修改值是多少 思路:遇到这类题型, ...

  3. 推翻自己和过往,重学自定义View

    http://blog.csdn.net/lfdfhl/article/details/51671038 深入探讨Android异步精髓Handler 站在源码的肩膀上全解Scroller工作机制 A ...

  4. minicom 不能输入

    minicom -s  进入设置界面 在 Serial port setup 中设置 硬件控制流为NO F - Hardware Flow Control : No 就OK了

  5. 【kmp】 字符串最大周期

    大侠住店 TimeLimit: 1 Second MemoryLimit: 32 Megabyte Totalsubmit: 116 Accepted: 64 Description 有一天晚上,一位 ...

  6. Android OpenGL ES(五)GLSurfaceView .

    Android OpenGL ES 相关的包主要定义在 javax.microedition.khronos.opengles    GL 绘图指令 javax.microedition.khrono ...

  7. thunk技术

    Thunk : 将一段机器码对应的字节保存在一个连续内存结构里, 然后将其指针强制转换成函数. 即用作函数来执行,通常用来将对象的成员函数作为回调函数. #include "stdafx.h ...

  8. [转]Android 如何对sqlite数据库进行增删改[insert、update和delete] 操作

    import android.content.ContentValues; import android.content.Context; import android.database.Cursor ...

  9. loadrunner常用计数器分析

    内存是第一个监视对象,确定系统瓶颈的第一个步骤就是排除内存问题.内存短缺的问题可能会引起各种各样的问题. Object(对象) Counters Description(描述) 参考值 Memory ...

  10. LoadRunner监控Unix、Windows方法及常用性能指标

    目  录 一.LoadRunner监控Linux资源.... 3 (一).准备工作... 3 1.可以通过两种方法验证服务器上是否配置了rstatd守护程序:... 3 (2)使用find命令... ...