杭电2803The MAX
来源:互联网 发布:佚名是谁 知乎 编辑:程序博客网 时间:2024/05/22 11:35
The MAX
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2054 Accepted Submission(s): 890
Problem Description
Giving N integers, V1, V2,,,,Vn, you should find the biggest value of F.
Input
Each test case contains a single integer N (1<=N<=100). The next line contains N integers, meaning the value of V1, V2....Vn.(1<= Vi <=10^8).The input is terminated by a set starting with N = 0. This set should not be processed.
Output
For each test case, output the biggest value of F you can find on a line.
Sample Input
21 20
Sample Output
4017
Source
HDU 2009-4 Programming Contest
Recommend
lcy | We have carefully selected several similar problems for you: 2807 2804 2800 2816 2806
把最大的乘以最大的,其余的都按照1 算就得到最大的了。
#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;__int64 a[1100],i,j,k,l,m,n,ans,num;int main(){while(scanf("%I64d",&n),n){ans=0;for(i=0;i<n;i++){scanf("%I64d",&a[i]);ans+=a[i];}sort(a,a+n);ans-=a[n-1];num=a[n-1]*(2010-n)+ans;//最大的放一个,其余的都化为1 printf("%I64d\n",num);}return 0;}
0 0
- 杭电2803The MAX
- 杭电-2803The MAX
- 【杭电】[2803]The MAX
- 【杭电2083】The MAX
- 【杭电oj】2803 - The MAX(水)
- 【杭电-oj】-2803-The MAX(sort快排)
- 杭电 1081 To The Max
- 杭电1081 To The Max
- 杭电 acm 1181 To The Max
- 杭电1081-To The Max
- 【杭电1081】To The Max
- 杭电ACM HDU 1594 find the max
- 杭电ACM HDU 1081 To The Max
- 杭电ACM1081——To The Max
- 杭电 HDU ACM 1081 To The Max
- 杭电1081—动态规划To The Max
- [杭电]Max Sum
- 杭电 Max Sum
- Fragment介绍:
- TCP/IP 面试题整理
- ios 方法 HTML数据中去除 标签
- mysql group by 用法解析(详细)
- poj--3630--Phone List(字典树+前缀判断)
- 杭电2803The MAX
- JavaScript作用域问题:预解析、全局与局部作用域解析、作用域链
- iOS 自动计算 高度
- java读取csv文件
- C语言基础-#include
- 代理delegate与通知Notification、block的使用区别
- 2015南阳ccpc L题
- iOS 使用Charles(青花瓷)抓包并篡改返回数据图文详解
- 比较好的GIS博客