题目链接:

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. 使用XtraGrid自定义列计算 z

    绑定Master-Detail 关系 数据也是数据显示的一种方式,此实例使用后台代码创建数据源并绑定到gridcontrol. 其实方式参见:点击打开链接 先看效果图(默认方式) 直接给出后台代码,主 ...

  2. talkingdata比赛分析

    1.kaggle数据分析经验: https://medium.com/unstructured/how-feature-engineering-can-help-you-do-well-in-a-ka ...

  3. maximum-depth-of-binary-tree——找出数的最大深度

    Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...

  4. meta标签多种用法

    <meta name=”google” content=”notranslate” /> <!-- 有时,Google在结果页面会提供一个翻译链接,但有时候你不希望出现这个链接,你可 ...

  5. wdatepicker ie8等问题

    官方文档:http://www.my97.net/demo/resource/2.4.asp 以下内容为使用中遇到的问题,具体该插件具有的方法请自行查阅官方文档. 1.当触发wdatepicker事件 ...

  6. Solaris 下解决上网问题以及远程登录问题

    解决乱码问题 参考文章 http://www.jb51.net/os/Solaris/1656.html solaris 显示乱码的解决方法 现象: 利用命令 : LANG=zh; export LA ...

  7. 云舒网络译:Rancher1.0正式版公布

    编者注: Rancher Labs是一家容器技术基础设施提供商,总部位于美国硅谷,Rancher是一个高效易用的企业容器云平台. 云舒网络 http://www.cloudsoar.com/为Ranc ...

  8. Oracle pipe

    初次接触到Report ,看到了它背后复杂的SQL操作, 首先看到了一个Pipe,先了解下PIPE的用法: 关键字PIPELINED表明这是一个oracle管道函数,oracle管道函数的返回值类型必 ...

  9. NumPy事例练习

    因为排版问题直接把jupyter里的截图过来了:暂时就写了这么点小例子,建议在ipython notebook中做测试

  10. Oracle SQL_杂记

    1. 查询当前用户角色,当前用户下的表权限以及所有用户表权限 desc user_role_privs;select * from user_role_privs; desc user_tab_pri ...