ds 3.4 value
来源:互联网 发布:电脑麦克风扩音软件 编辑:程序博客网 时间:2024/05/17 00:50
/***************Problem from :Problem describe :以某个点为最小值 向该点左右延伸, 保证延伸的区间中 该点依旧为最小值 data:****************/#include<iostream>#include<cstdlib>#include<cstdio>#include<algorithm>#include<cmath>#include<map>#include<stack>#include<queue>#include<ctime>#include<cstring>#include<vector>#include<string>#define ll __int64#define inf 0x3f3f3f3f3fusing namespace std;const int N=100005;__int64 sum[N], a[N];int main(){int i, j, k, m, n;scanf("%d", &n);for(i=1; i<=n; i++){scanf("%I64d", &a[i]);sum[i] = sum[i-1] + a[i];//前缀和 }__int64 MAX=-1;for(i=1; i<=n; i++)//循环枚举每个点 {int l=i-1, r=i;int t=a[i];while(l>=1 && a[l]>=a[i]) l--;//向左延伸 for(j=i+1; j<=n; j++)//向右延伸 {//与枚举的点相等的时候 将枚举指针 i 向后移动, 避免同一个值重复多次为最小值while(a[j]==a[i]){r=j;i++;j++;}if(a[j]>=a[i]) r=j;else break;}__int64 s=(sum[r]-sum[l])*t;//根据已经确定的左指针以及右指针计算出和 if(s>MAX) MAX=s;}printf("%I64d\n", MAX);return 0;}
0 0
- ds 3.4 value
- ds
- ds
- ds
- ds
- ds
- DS
- ds
- ds
- ds
- ds
- ds
- ds
- DS
- ds
- ds
- How to get the default value in the paramter block description of 3ds max
- 此ds非ds
- python暴力破解zip密码文件
- 缩短搜索时间小窍门
- Github常见命令行
- 装饰模式例子(Decorator Pattern)
- 编写一个程序,一行行地读取输入行,直至到达文件尾。算出每行输入行的长度,然后把最长的那行打印出来。为了简单起见,你可以假定所有的输入行均不超过1000个字符。
- ds 3.4 value
- 一维数组
- bootstrap加载状态Button使用方法
- Android视频直播的实现
- NYOJ-17 单调递增最长子序列
- 软件测试基础和流程
- 一道未完成的题
- 欢迎使用CSDN-markdown编辑器
- 【C#】App.Config配置文件说明