#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. shell之路【第三篇】流程控制

    if语句 if ... fi 语句: if ... else ... fi 语句: if ... elif ... else ... fi 语句. 注意: expression 和方括号([ ])之间 ...

  2. java web 项目如何部署到互联网中 通过输入域名访问?

    https://segmentfault.com/q/1010000000710271

  3. think in uml-关系

    1.关联关系association 在一段时间内将多个类的实例连接在一起 某个对象在一段时间内一直"知道"另一个对象的存在 2.依赖关系dependency 一个对象的修改会导致另 ...

  4. KVM 基本硬件容量扩容

    在工作当中如果虚拟机的容量不够使用 如何添加呢? CPU添加 cpu添加有两种方式: 1 创建虚拟机的时候可以添加 # virt-install --help | grep cpu --vcpus=V ...

  5. URL的# (转)

    http://www.ruanyifeng.com/blog/2011/03/url_hash.html

  6. 使用oracle数据库开发,异常总结

    最近两天使用的oracle数据库开发项目时遇到了2个异常,第一个是执行sql语句时报异常:“ORA-00911: 无效字符”,如下图: sql语句如下: 断点调试,把sql语句拷贝到pl/sql里执行 ...

  7. git push origin master 报错 remote rejected] master -> master (branch is currently checked out)

    解决办法: 977down vote You can simply convert your remote repository to bare repository (there is no wor ...

  8. WPF(x:Null 使用)

    <Window x:Class="TestOfNull.MainWindow" xmlns="http://schemas.microsoft.com/winfx/ ...

  9. ngnix配置文件

    使用nginx最大的好处就是负载均衡. #设定负载均衡的服务器列表    upstream service{        server 10.4.29.174:7477;    } server { ...

  10. F(k)<(维护+枚举)\(找规律+递推+枚举)>

    题意 小明有一个不降序列(f(1),f(2),f(3),--),f(k)代表在这个序列中大小是k的有f(k)个.我们规定f(n)的前12项如下图. n 1 2 3 4 5 6 7 8 9 10 11 ...