#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <cctype>
#include <vector>
#include <iterator>
#include <set>
#include <map>
#include <sstream>
using namespace std; #define mem(a,b) memset(a,b,sizeof(a))
#define pf printf
#define sf scanf
#define spf sprintf
#define pb push_back
#define debug printf("!\n")
#define INF 10000
#define MAXN 5010
#define MAX(a,b) a>b?a:b
#define blank pf("\n")
#define LL long long
#define ALL(x) x.begin(),x.end()
#define INS(x) inserter(x,x.begin())
#define pqueue priority_queue int n;
int mp[]; int main()
{
int i,j;
while(sf("%d",&n)==)
{
mem(mp,);
for(i=;i<n;i++)
{
sf("%d",&mp[i]);
}
sort(mp,mp+n);
if(n==)
{
pf("-1\n");
continue;
}
if(n==)
{
int d = mp[]-mp[];
if(d==)
{
pf("1\n%d\n",mp[]);
}
else if(d%==)
{
pf("3\n%d %d %d\n",mp[]-d,mp[]+d/,mp[]+d);
}
else
{
pf("2\n%d %d\n",mp[]-d,mp[]+d);
}
}
if(n==)
{
int d = mp[]-mp[];
int d2 = mp[]-mp[];
if(d==d2)
{
pf("2\n%d %d\n",mp[]-d,mp[]+d);
}
else if(d==d2*)
pf("1\n%d\n",mp[]+d2);
else if(d*==d2)
pf("1\n%d\n",mp[]+d);
else
pf("0\n");
}
if(n>)
{
int cnt=,cnt2=,find=,d2,ok=,x;
int d = mp[]-mp[];
for(i=;i<n-;i++)
{
int tmp = mp[i+]-mp[i];
if(d==tmp) cnt++;
else
{
if(!find)
{
d2=tmp;
find=;
x = i;
}
if(tmp==d2)
cnt2++;
else
{
ok=;break;
}
}
}
if(!ok)
{
pf("0\n");
continue;
}
if(cnt==n-)
{
pf("2\n%d %d\n",mp[]-d,mp[n-]+d);
}
else if(cnt==n-)
{
if(d2==d*)
{
pf("1\n%d\n",mp[x]+d);
}
else
pf("0\n");
}
else
{
if(d==d2*)
{
pf("1\n%d\n",mp[]+d2);
}
else
pf("0\n");
}
} }
}
#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <cctype>
#include <vector>
#include <iterator>
#include <set>
#include <map>
#include <sstream>
using namespace std; #define mem(a,b) memset(a,b,sizeof(a))
#define pf printf
#define sf scanf
#define spf sprintf
#define pb push_back
#define debug printf("!\n")
#define INF 10000
#define MAXN 5010
#define MAX(a,b) a>b?a:b
#define blank pf("\n")
#define LL long long
#define ALL(x) x.begin(),x.end()
#define INS(x) inserter(x,x.begin())
#define pqueue priority_queue int n;
int a[];
map<int,int> mp; int main()
{
int i,j;
while(sf("%d",&n)==)
{
mp.clear();
for(i=;i<n;i++)
{
sf("%d",&a[i]);
mp[a[i]]++;
}
map<int,int>::iterator it;
int res[],cnt=,ok=;
for(it=mp.begin();it!=mp.end();it++)
{
if(it->second)
{
res[cnt++] = it->first;
it->second--;
if(cnt==)
{
pf("%d %d %d\n",res[],res[],res[]);
cnt=;
ok=;
it = mp.begin();
}
}
}
if(!ok) pf("0\n");
}
}

SZU4的更多相关文章

随机推荐

  1. 案例1-合并2个不同文件夹中的csv文件到另外一个目录,相同的文件名进行数据合并,不同的文件名直接移到新文件夹

    发现在ubuntu和centos中有些命令还不一样,比如<<<可在centos中使用,但是ubuntu中不行 csv文件名以及格式如下 3669_20180121.csv 总笔数,2 ...

  2. bootstrap-table教程演示

    Bootstrap Admin 效果展示 Table of contents Create Remove Update Export Tree Create 相关插件 bootstrap-valida ...

  3. mysql5.7解压版版安装步骤详情

    mysql有安装版和解压版之分: 安装版:以msi结尾的,这种版本优点是安装便捷,全是傻瓜式的下一步:缺点是会不自觉的安装一些我们根本不需要的组件. 解压版:以zip或者其他压缩格式结尾的,这种版本虽 ...

  4. luogu P1080国王游戏

    贪心加高精 传送门:QWQ 先考虑两个人 a0 b0 p1 a1 b1 p2 a2 b2 那么满足:\(\huge ans1=\max(\frac{a0}{b1} , \frac{a0a1}{b2}) ...

  5. P4173 残缺的字符串

    题目链接 题意分析 啥 ? ? ? \(FFT\)做字符串匹配 可是就是这样 我们定义匹配函数 我们定义\(A\)是匹配串 \(B\)是被匹配串 我们当前到达\(B\)串的\(x\)位置 \[P(x) ...

  6. Netty 5 获取客户端IP(非HTTP)

    使用Netty 5.0.0.Alpha2时,想知道客户端的ip以区分客户端,发现网上都是通过解析HTTP头域完成的,这里提供一种比较简单的方法. System.out.println("Cl ...

  7. css 清楚浮动三种方法

    我们可以看到这样一个布局: <style> .left{ width: 200px; height: 200px; background-color: #00ee00; float: le ...

  8. Jenkins Slave Nodes – using the Swarm Plugin

    link: http://www.donaldsimpson.co.uk/2013/03/18/jenkins-slave-nodes-using-the-swarm-plugin/ I’ve bee ...

  9. Vue学习笔记 template methods,filters,ChromeDriver,安装sass

    ChromeDriver installation failed Error with http(s) request: Error: connect ETIMEDOUT 172.217.160.80 ...

  10. gitlab之gitlab-runner自动部署(二)

    转载自:https://blog.csdn.net/hxpjava1/article/details/78514999 简介 gitlab-ci全称是gitlab continuous integra ...