The MAX

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

Total Submission(s): 2042    Accepted Submission(s): 883

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
HDU 2009-4 Programming Contest



同样的代码,不一样的提交时间,咋就这么坑呢,坑了我一早上,都快哭了,这麽一道水题,唉~~~

#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
int n;
while(scanf("%d",&n),n)
{
long long a[110],ans=0;
for(int i=0;i<n;i++)
scanf("%lld",&a[i]);
sort(a,a+n);
for(int i=0;i<n;i++)
{
if(i==n-1)
ans+=a[i]*(2009-n+1);
else ans+=a[i];
}
printf("%lld\n",ans);
}
return 0;
}

 

hdoj--2803--The MAX(水题)的更多相关文章

  1. hdoj 2803 The MAX【简单规律题】

    The MAX Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Sub ...

  2. HDOJ 1056 HangOver(水题)

    Problem Description How far can you make a stack of cards overhang a table? If you have one card, yo ...

  3. HDOJ(HDU) 1718 Rank(水题、、、)

    Problem Description Jackson wants to know his rank in the class. The professor has posted a list of ...

  4. hdoj 5198 Strange Class 水题

    Strange Class Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid ...

  5. hdoj 4450 Draw Something 水题

    Draw Something Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tota ...

  6. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  7. 水题 HDOJ 4727 The Number Off of FFF

    题目传送门 /* 水题:判断前后的差值是否为1,b[i]记录差值,若没有找到,则是第一个出错 */ #include <cstdio> #include <iostream> ...

  8. 水题 HDOJ 4716 A Computer Graphics Problem

    题目传送门 /* 水题:看见x是十的倍数就简单了 */ #include <cstdio> #include <iostream> #include <algorithm ...

  9. hdu 2710 Max Factor 数学(水题)

    本来是不打算贴这道水题的,自己却WA了三次.. 要考虑1的情况,1的质因子为1 思路:先打表 ,然后根据最大质因子更新结果 代码: #include<iostream> #include& ...

随机推荐

  1. 一次显式GC导致的High CPU问题处理过程

    项目现场反馈系统出现性能问题,具体表现为:所有的客户端响应极其卡顿. 第一反应推测,难道是DB层面出现阻塞?检查v$session会话状态及等待类型未见异常,应该可以排除DB层面原因导致的可能. 继续 ...

  2. C++ 类型转换操作与操作符重载 operator type() 与 type operator()

    类型转换操作符(type conversion operator)是一种特殊的类成员函数,它定义将类类型值转变为其他类型值的转换.转换操作符在类定义体内声明,在保留字 operator 之后跟着转换的 ...

  3. webpack-1

    1.webpack 安装新项目npm install --save-dev webpack如果版本较老,在package,json中找到版本号,修改成你要的版本号,在删除node-model文件夹,执 ...

  4. canvas的常用api

    canvas 标签 <canvas width="600" height="400" id="canvas"></canv ...

  5. express jade ejs 为什么要用这些?

    express是快速构建web应用的一个框架   线上文档 http://www.expressjs.com.cn/ 不用express行不行呢?    看了网上的回答:不用express直接搭,等你 ...

  6. 错误:Camera录制视频(6.0错误),5.1正常,7.1正常 (java.lang.RuntimeException: start failed.at android.media.MediaRecorder.native_start(Native Method))

    Process: com.example.mycamera2, PID: 24086 java.lang.RuntimeException: start failed. at android.medi ...

  7. DataTable和DataRow和DataColumn ~~~~~~~~~~[][]

    DataSet.Tables[0].Rows[0][1]表示DataSet中第一张表(因为Tables[0]就是第一张表的意思)中第一行(Rows[0][]) 第二列(Rows[][1])的数据. D ...

  8. 使用一行代码解决IE浏览器兼容问题

    在网站开发中不免因为各种兼容问题苦恼,针对兼容问题,其实IE给出了解决方案Google也给出了解决方案 百度也应用了这种方案去解决IE的兼容问题 百度源代码如下 <!Doctype html&g ...

  9. Qt5—嵌入停靠窗口QDockWidget

    参考链接:http://blog.csdn.net/summer_xiyer/article/details/12875899 新建一个GUI工程: QDockWidget是QWidget的子类,也等 ...

  10. ES: 机器学习、专家系统、控制系统的数学映射

    一.基本定义    1.机器学习维基定义:机器学习有下面几种定义: "机器学习是一门人工智能的科学,该领域的主要研究对象是人工智能,特别是如何在经验学习中改善具体算法的性能". & ...