#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.Java Spring MVC入门 安装

    Spring 下载地址: 4.3.6.RELEASE/ 25-Jan-2017 14:05 - http://repo.spring.io/release/org/springframework/sp ...

  2. js导出页面的表格到excel(NB的大神洗了好几个,挑一个记下来)

    var idTmr; function getExplorer() { var explorer = window.navigator.userAgent ; //ie if (explorer.in ...

  3. h5 fieldset

    http://www.w3school.com.cn/tiy/t.asp?f=html_fieldset 这个标签可以让border里面写入文字

  4. mysql查询语句常用字段操作函数

    一.concat()函数 1.功能:将多个字符串连接成一个字符串. 2.语法:concat(str1, str2,...) 返回结果为连接参数产生的字符串,如果有任何一个参数为null,则返回值为nu ...

  5. webpack中设置jquery为全局对象

    通过npm安装jquery npm install jquery -D 然后配置webpack-config.js plugins: [ new webpack.ProvidePlugin({ $: ...

  6. React.Children详解

    React.Children提供了处理this.props.children的工具,this.props.children可以任何数据(组件.字符串.函数等等).React.children有5个方法 ...

  7. Linux命令-关机命令:shutdown

    shutdown -h now 现在马上关机 shutdown -h : 晚上8:30定时关机shutdown -r now 现在马上重起shutdown -r 20:30 晚上8:30定时重起 ca ...

  8. BZOJ1721 Ski Lift 缆车支柱

    Description Farmer Ron in Colorado is building a ski resort for his cows (though budget constraints ...

  9. DEM反应添加顺序注意问题

    在含有DEM反应的dat中,均相反应的block要在DEM反应之前,例如: @(RXNS) (some reaction equations) @(END) @(DES_RXNS) (some rea ...

  10. 进阶篇:4.4)DFA设计指南:面向高速自动化装配设计

    本章目标:更进一步,设计出符合高速自动化装配的零件. 1.前言 中国的人口红利时代正在慢慢地过去,这是事实.同时,机器换人与大自动化的时代也在到来. 在这个时代中,人工成本越来越高,零部件的装配和库存 ...