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. C#使用ICSharpCode.SharpZipLib.dll进行文件的压缩与解压

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.I ...

  2. [lua]异步串行流程*协程

    local function param_pack( params, callback ) table.insert(params, callback) return params end local ...

  3. 前端-JQ思维导图

    看不清的朋友右键保存或者新窗口打开哦!喜欢我可以关注我,还有更多前端思维导图笔记

  4. CSS读书笔记(2)---简易相册和日历表的制作

    一.HTML和CSS制作的简易相册 相册在默认情况下是缩略图显示,而且是截取相片的某一部分显示的.当鼠标停留在某张缩略图上,相册列表中的缩略图变为大图,展示在相册的左边区域, 同时缩略图部分变成空的 ...

  5. 图片无损放大软件PhotoZoom分屏预览功能 ,简直好用!

    PhotoZoom是一款智能放大图片软件,很多用户在初次使用PhotoZoom,发现图片所处的区域上方有四个不同方式的预览选项.因为很多初学者使用时不明白这四个按钮有什么作用,所以小编接下来讲解一下P ...

  6. Bootstrap 有一个 class 属性叫做 well,它的作用是为设定的列创造出一种视觉上的深度感

    Bootstrap 有一个 class 属性叫做 well,它的作用是为设定的列创造出一种视觉上的深度感

  7. [SCOI2008]奖励关_状压动归_数学期望

    Code: #include<cstdio> #include<algorithm> using namespace std; const int maxn = 20; dou ...

  8. DAO DTO VO BO

    DAO叫数据访问对象DTO是数据传输对象DAO通常是将非对象数据(如关系数据库中的数据)以对象的方式操纵.DTO通常用于不同层(UI层.服务层或者域模型层)直接的数据传输,以隔离不同层,降低层间耦合 ...

  9. 【airtest】iOS,Android 依托 jenkins 并行跑

    Airtest 只支持一台mac 连接一台iPhone,  以下方法是以“一台mac 连接一台iPhone”为基础,依托jenkins 统一管理多台iPhone. [mac] jenkins mast ...

  10. Vue学习之路第十三篇:v-for指令

    v-for指令,看名字想必大家也能猜到其作用,没错,就是用来迭代.遍历的. 1.简单数组的遍历 <body> <divi id="app"> <spa ...