HDU2803 The MAX 【水题】
来源:互联网 发布:网达软件 编辑:程序博客网 时间:2024/05/02 04:24
http://acm.hdu.edu.cn/showproblem.php?pid=2803
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
AC代码:
#include <cstdio>#include <algorithm>using namespace std;long long a[110];int main(){ int N; while(~scanf("%d",&N),N) { for(int i=0;i<N;++i) { scanf("%lld",a+i); } sort(a,a+N); long long res=0; for(int i=0;i<N-1;++i) res+=a[i]; res+=a[N-1]*(2009-N+1); printf("%lld\n",res); } return 0;}
0 0
- HDU2803 The MAX 【水题】
- HDOJ 2803 The MAX(水题)
- hdoj 2803 The MAX 【水题】
- HDOJ 2803 The MAX【水题】
- The MAX
- The MAX
- The MAX
- THE MAX
- The MAX
- hdu2803(数学题)
- hdoj--2803--The MAX(水题)
- zoj1074 To the Max
- 1074 To the Max
- 1050 To the Max
- POJ1050 To the Max
- POJ1050 To the Max
- HDU 2803 The Max
- POJ_1050_To the Max
- V8内存管理之作用域
- hdoj--1495--非常可乐(搜索+隐式图)
- C语言中求字符串长度
- 《剑指offer》——反转链表
- 《NoSQL精粹》各章要点
- HDU2803 The MAX 【水题】
- hdu 5524 规律题
- java设计模式---享元模式
- 直方图规定化
- c++常见面试题
- HDOJ-1495-非常可乐【广搜】
- 常用数据压缩库的编译与使用
- AltiumDesigner03——将别人库中的元件加入自己的库中
- 《剑指offer》——旋转数组的最小数字