博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
杭电2803--The MAX(分析题)
阅读量:7037 次
发布时间:2019-06-28

本文共 1385 字,大约阅读时间需要 4 分钟。

The MAX

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 2033    Accepted Submission(s): 878

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
2 1 2 0
 

 

Sample Output
4017
 

 

Source
 

 

Recommend
lcy   |   We have carefully selected several similar problems for you:            
图上给了很多信息, 然而我还是粗心没有看出Xi 可以取相同的数, WA两次。
#include 
#include
#include
using namespace std; bool cMp(int a, int b){ return a > b;}int main(){ __int64 num[101]; int T; while(~scanf("%d", &T), T){ for(int i = 0; i < T; i++) scanf("%I64d", &num[i]); sort(num, num+T, cMp); // int P = (T-1)%2==0? (T-1)/2*T:T/2*(T-1); // int Q = 2009 - P; // __int64 sum = num[0]*Q; __int64 sum = num[0]*(2010-T); // printf("%I64d\n", sum); for(int i = 1; i < T; i++) sum += num[i]; printf("%I64d\n", sum); } return 0;}

 

 
 

转载于:https://www.cnblogs.com/soTired/p/4927463.html

你可能感兴趣的文章
物联网架构成长之路(24)-Docker练习之Compose容器编排
查看>>
set 容器的用法
查看>>
iocp (改天完善)
查看>>
水波探测算法的实现
查看>>
JsDemo
查看>>
JQuery EasyUI Tree
查看>>
.net Sql server 事务的两种用法
查看>>
【143】360云盘资源
查看>>
gradle编译出错:Execution failed for task &#39;:app:compileTestDebugJava&#39;.
查看>>
django之创建第9个项目-管理后台admin
查看>>
中国电信某站点JBOSS任意文件上传漏洞
查看>>
030 分布式集群中,设定时间同步服务器,以及ntpd与ntpdate的区别
查看>>
Oracle10G 连接11G数据库,出现ORA -1017用户名/口令无效; 登录被拒绝 的问题
查看>>
Android - 隐藏EditText弹出的软键盘输入(SoftInput)
查看>>
ActiveMQ + NodeJS + Stomp 极简入门
查看>>
【转】图说设计模式
查看>>
Perl和操作系统交互(二):fork
查看>>
virtualBox centos 6.5 硬盘扩容
查看>>
瑞星:“云攻击”已成现实
查看>>
微软下周将发布三个补丁 仍有漏洞未修复
查看>>