poj 2291水题
来源:互联网 发布:软件成本 标准 编辑:程序博客网 时间:2024/06/10 06:11
http://poj.org/problem?id=2291
线段树做累了来题水题
Description
Input
Output
Sample Input
2310 1 15210 15
Sample Output
2020
Source
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn =1010;
int a[maxn];
const int INF = 0x3f3f3f3f;
int cmp(int a,int b){
return a>b;
}
int main(){
int t;
scanf("%d",&t);
while(t--){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}
sort(a,a+n,cmp);
// for(int i=0;i<n;i++){
// printf("a[i]=%d\n",a[i]);
// }
int maxx=-INF;
for(int i=0;i<n;i++){
if(a[i]*(i+1)>maxx){
maxx=a[i]*(i+1);
}
}
printf("%d\n",maxx);
}
return 0;
}
- poj 2291水题
- POJ 2291水题
- poj 2291
- poj水题
- POJ 水题
- POJ 水题
- poj水题
- poj 水题
- poj 水题
- POJ水题
- poj水题
- poj 水题
- POJ水题
- POJ水题
- [poj] 水题2159
- POJ 2665 水题
- POJ 3094 Quicksum 水题
- POJ 1125 floyd水题
- C#/mono开发Android应用程序实际意义。
- document.getElementById与getElementsByName的区别(注意后者多个S)
- ListView一些特殊属性
- 两个String类型集合的比对(或 两个表的比对)
- C#的元组Tuple类型
- poj 2291水题
- Excel2007格式分析和XML解析
- 【IPHONE开发-OBJECTC入门学习】文件的操作,读写复制文件
- cocos2d-x如何添加精灵动画(适合于2以上的版本)
- Fragment生命周期备忘
- 百度定位API,基站定位,WiFi定位,POST上传
- 面向对象设计原则:LisKov替换原则(LSP)
- Dvi转pdf 图片消失的问题
- Android WebView Memory Leak WebView内存泄漏