/*
HDU 6168 - Numbers [ 思维 ] | 2017 ZJUT Multi-University Training 9
题意:
....
分析:
全放入multiset 从小到大,慢慢筛
*/
#include <bits/stdc++.h>
using namespace std;
const int N = 125250;
int n, s[N];
int a[N], cnt;
multiset<int> st;
multiset<int>::iterator it, pos;
int main()
{
int x;
while (~scanf("%d", &n))
{
st.clear();
for (int i = 1; i <= n; ++i)
{
scanf("%d", &x);
st.insert(x);
}
cnt = 0;
for (it = st.begin(); it != st.end(); it++)
{
a[++cnt] = *it;
for (int i = 1; i < cnt; i++)
{
pos = st.find(a[i]+a[cnt]);
st.erase(pos);
}
}
printf("%d\n", cnt);
for (int i = 1; i < cnt; i++) printf("%d ", a[i]);
if (cnt) printf("%d\n", a[cnt]);
}
}

  

HDU 6168 - Numbers | 2017 ZJUT Multi-University Training 9的更多相关文章

  1. 2017 ACM暑期多校联合训练 - Team 9 1008 HDU 6168 Numbers (模拟)

    题目链接 Problem Description zk has n numbers a1,a2,...,an. For each (i,j) satisfying 1≤i<j≤n, zk gen ...

  2. hdu 6168 Numbers

    Numbers Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total S ...

  3. HDU 6170 - Two strings | 2017 ZJUT Multi-University Training 9

    /* HDU 6170 - Two strings [ DP ] | 2017 ZJUT Multi-University Training 9 题意: 定义*可以匹配任意长度,.可以匹配任意字符,问 ...

  4. HDU 6162 - Ch’s gift | 2017 ZJUT Multi-University Training 9

    /* HDU 6162 - Ch’s gift [ LCA,线段树 ] | 2017 ZJUT Multi-University Training 9 题意: N节点的树,Q组询问 每次询问s,t两节 ...

  5. 2016 Al-Baath University Training Camp Contest-1

    2016 Al-Baath University Training Camp Contest-1 A题:http://codeforces.com/gym/101028/problem/A 题意:比赛 ...

  6. keras使用多GPU并行训练模型 | keras multi gpu training

    本文首发于个人博客https://kezunlin.me/post/95370db7/,欢迎阅读最新内容! keras multi gpu training Guide multi_gpu_model ...

  7. HDU 6102 - GCDispower | 2017 Multi-University Training Contest 6

    个人感觉题解的复杂度很玄,参不透,有没有大佬讲解一下- - /* HDU 6102 - GCDispower [ 数论,树状数组] | 2017 Multi-University Training C ...

  8. HDU 6098 - Inversion | 2017 Multi-University Training Contest 6

    /* HDU 6098 - Inversion [ 贪心,数论 ] | 2017 Multi-University Training Contest 6 题意: 求出所有B[i] = max(A[j] ...

  9. HDU 6105 - Gameia | 2017 Multi-University Training Contest 6

    /* HDU 6105 - Gameia [ 非平等博弈 ] | 2017 Multi-University Training Contest 6 题意: Bob 可以把一个点和周围所有点都染黑,还有 ...

随机推荐

  1. Redis搭建Windows平台

    安装程序下载 从官网下载安装程序. https://redis.io/download https://github.com/MicrosoftArchive/redis/releases 新地址:h ...

  2. HDOJ-1100 Trees made to order

    一.题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1100 二.题目分析 对二叉树的所有形态顺序编号,编号规则是:节点数越多的编号越大:节点数相等,左子 ...

  3. T-SQL学习笔记

    学习T-SQL时记录的笔记,记得并不全也不详细 if和while语句 declare @age int select @age = DATEDIFF(year,stuAge,getdate()) fr ...

  4. Arm-Linux 移植 jpeg库

    背景: jpeg库的使用可以提高显示效率. host平台 :Ubuntu 16.04 arm平台 : S5P6818   jpeg    :v9c arm-gcc :4.8.1 主机准备: 运行以下脚 ...

  5. jQuery控制页面滚动条上下滚动

    .向上滚动  $(); .向下滚动   $(); 参数解读:$(this)表示要实现上下滚动的对象,-50表示向上滚动50px , +50表示向下滚动50px ,1000表示滚动速度

  6. elasticsearch 开机自启

    linux下开机自启: 在/etc/init.d目录下新建文件elasticsearch 并敲入shell脚本: #!/bin/sh #chkconfig: #description: elastic ...

  7. 前端开发 Vue -4promise解读2

    https://www.runoob.com/vue2/vue-tutorial.html promise promise是什么?   1.主要用于异步计算 2.可以将异步操作队列化,按照期望的顺序执 ...

  8. solr的post.jar

    http://iamyida.iteye.com/blog/2207920   跟益达学Solr5之玩转post.jar

  9. js入门之内置数组对象 Array

    一. 数组 1. 创建数组的两种方式 1. 数组字面量 var array = [] 2. 数组的构造函数创建数组 var array = new Array(); 2. 如何判断一个变量是否是数组 ...

  10. Traceback (most recent call last): File "../zubax_chibios/tools/make_boot_descriptor.py", line 251

    出现如下错误: Traceback (most recent call last): File "../zubax_chibios/tools/make_boot_descriptor.py ...