题目链接:

Summary

Time Limit: 2000/1000 MS (Java/Others)   

 Memory Limit: 32768/32768 K (Java/Others)

Problem Description
 
Small W is playing a summary game. Firstly, He takes N numbers. Secondly he takes out every pair of them and add this two numbers, thus he can get N*(N - 1)/2 new numbers. Thirdly he deletes the repeated number of the new numbers. Finally he gets the sum of the left numbers. Now small W want you to tell him what is the final sum.
 
Input
 
Multi test cases, every case occupies two lines, the first line contain n, then second line contain n numbers a1, a2, ……an separated by exact one space. Process to the end of file.
[Technical Specification]
2 <= n <= 100
-1000000000 <= ai <= 1000000000
 
Output
 
For each case, output the final sum.
 
Sample Input
4
1 2 3 4
2
5 5
 
Sample Output
25
10
 
题意:
 
求生成的数的和,重复的去掉;
 
思路:
 
水题;
 
AC代码:
 
#include <bits/stdc++.h>
using namespace std;
const int N=3e5+;
typedef long long ll;
int n,a[];
queue<int>qu;
map<int,int>mp;
int main()
{
while(scanf("%d",&n)!=EOF)
{
ll ans=;
for(int i=;i<=n;i++)
{
scanf("%d",&a[i]);
}
for(int i=;i<=n;i++)
{
for(int j=i+;j<=n;j++)
{
mp[a[i]+a[j]]=;
qu.push(a[i]+a[j]);
}
}
while(!qu.empty())
{
int fr=qu.front();
qu.pop();
if(mp[fr]==)ans+=fr,mp[fr]=;
}
printf("%lld\n",ans);
}
return ;
}

hdu-4989 Summary(水题)的更多相关文章

  1. hdu 5210 delete 水题

    Delete Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5210 D ...

  2. hdu 1251 (Trie水题)

    统计难题 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131070/65535 K (Java/Others)Total Submi ...

  3. HDU 5703 Desert 水题 找规律

    已知有n个单位的水,问有几种方式把这些水喝完,每天至少喝1个单位的水,而且每天喝的水的单位为整数.看上去挺复杂要跑循环,但其实上,列举几种情况之后就会发现是找规律的题了= =都是2的n-1次方,而且这 ...

  4. HDU 4493 Tutor 水题的收获。。

    题目: http://acm.hdu.edu.cn/showproblem.php?pid=4493 题意我都不好意思说,就是求12个数的平均数... 但是之所以发博客,显然有值得发的... 这个题最 ...

  5. hdu 4802 GPA 水题

    GPA Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4802 Des ...

  6. hdu 4493 Tutor 水题

    Tutor Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4493 D ...

  7. hdu 5495 LCS 水题

    LCS Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5495 Descr ...

  8. hdu 4891 模拟水题

    http://acm.hdu.edu.cn/showproblem.php?pid=4891 给出一个文本,问说有多少种理解方式. 1. $$中间的,(s1+1) * (s2+1) * ...*(sn ...

  9. hdu 5734 Acperience 水题

    Acperience 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5734 Description Deep neural networks (DN ...

随机推荐

  1. TClientDataSet的 fastscript封装

    TClientDataSet的 fastscript封装 // 陈新光 2017-2-10// TClientDataSet's fastscript unit fs_ClientDataSet; i ...

  2. android studio 在线更新android sdk,遇到无法Fetching https://dl-ssl.google.com/...的解决方案

    最近实在受不了eclipse的“迟钝”,准备入手Android studio开发环境,但是貌似不太顺利,成功安装了Android studio,在线更新Android adk的时候,总是遇到如下错误: ...

  3. chm 转 pdf 工具推荐与对比

    在进行推荐chm转pdf的软件之前,首先来了解一下为什么我们要将chm转为pdf. CHM是英语“Compiled Help Manual”的简写,即“已编译的帮助文件”.CHM是微软新一代的帮助文件 ...

  4. caffe版faster-RCNN环境搭建

    faster-rcnn提出论文: <Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks& ...

  5. Linq查询满足条件记录集

    通过linq查询datatable数据集合满足条件的数据集 1.首先定义查询字段的变量,比方深度 string strDepth=查询深度的值: var dataRows = from datarow ...

  6. SWF代码分析与破解之路 (YueTai VIP视频信息获取工具) Socket续篇

    引言 上一篇 <Socket与站点保密应用 (隐藏链接的视频下载)>大大咧咧地从 WEB 讲 Socket.再到 TCP/IP 等协议,又再讲到 Wireshark 怎样抓IP包分析.最还 ...

  7. 20. Spring Boot Servlet【从零开始学Spring Boot】

    转载:http://blog.csdn.net/linxingliang/article/details/52069482 Web开发使用 Controller 基本上可以完成大部分需求,但是我们还可 ...

  8. fastjson中Map与JSONObject互换,List与JOSNArray互换的实现

    1.//将map转换成jsonObject JSONObject itemJSONObj = JSONObject.parseObject(JSON.toJSONString(itemMap)); 将 ...

  9. c# 时间相关

    1.求时间差,两种方式(时间是否小于1800秒) 第一种: DateTime startTime = DateTime.Now; ... DateTime.Now.Subtract(startTime ...

  10. 使用fuser命令kill一个终端(特殊文件)的方法

    /*********************************************************************  * Author  : Samson  * Date   ...