F - The MAX(sort)
2016-07-20 09:01
169 查看
F - The MAX(sort)
Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmit
Status
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
2
1 2
0
Sample Output
4017
#include<iostream> #include<cstring> #include<algorithm> #include<cmath> #include<cstdio> using namespace std; int a[1111]; int max(long long a,long long b) { return a>b?a:b; } int main() { long long s,i,j,m,n,cnt,k=0,c,l;//数据短吗 为毛溢出 while(scanf("%lld",&n),n) { s=0; m=0; for(i=1;i<=n;++i) { cin>>a[i]; s+=a[i]; m=max(a[i],m); } s+=m*(2009-n+1)-m; cout<<s<<endl; } return 0; }
相关文章推荐
- HDU 5011-game -nim游戏变种
- hdu 1384逆序数 暴力法
- quartz定时器demo类
- javascript特效实现――当前时间和倒计时效果的简单实例
- What is Vertical Align?
- Java网络编程,Socket,ServerSocket使用,TCP,UDP的异同
- jquery数字递增递减
- HDU 5015-233 Matrix-矩阵快速幂
- JavaScript核心(晋级高手必读篇)
- 设计模式——策略模式
- Java程序:使用LinkedList存储扑克牌,实现洗牌功能
- 适配器模式
- 小技巧:电脑键盘上我不知道的秘密(快捷键+组合)
- Tomcat配置外置路径
- PHP简单日历实现方法
- 【iOS学习笔记 16-7-20】mac os 10.11.4下cocoapod不能正常使用问题
- 选择排序
- http://www.cnblogs.com/xdp-gacl/p/3902537.html
- Ubuntu 16.04上安装 Swift 3.0及问题解答
- C#中压缩/解压缩7-zip文件的方法