#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. MyBatis框架流程

    Hibernate与Mybatis的本质区别和应用场景 Hibernate:标准的ORM框架,不需要写SQL语句,但是优化和修改SQL语句比较难. 应用于需求变化固定的中小型的项目,例如后台管理系统. ...

  2. Web App三年将取代原生App?

    从技术角度讲,html5现在是可以获取很多用户的资源,上传提交服务器,与用户进行交互.但是你可以观察一下PC或Mac,web网页发展了这么长时间了,取代了客户端了吗? 对于现在而言,html5虽已可以 ...

  3. 题目1018:统计同成绩学生人数(hash简单应用)

    问题来源 http://ac.jobdu.com/problem.php?pid=1018 问题描述 给你n位同学的成绩,问获得某一成绩的学生有多少位. 问题分析 初见此题,有人会想到先将所有成绩存入 ...

  4. TP5.0学习历程(1)

    验证码的使用 控制器代码如下: $captcha = new \think\captcha\Captcha();         if (!$captcha->check($data['code ...

  5. Java学习笔记01

    1.原型设计: 将页面的模块.元素.人机交互的形式,利用线框描述的方法,将产品脱离皮肤状态下更加具体跟生动的进行表达. 2.下面的是使用PowerDesigner进行设计的持久层的层次结构图: 虚线三 ...

  6. CSS定位属性

                  定位属性                                                              position属性 1.      s ...

  7. 论文阅读 | ExtremeNet:Bottom-up Object Detection by Grouping Extreme and Center Points

    相关链接 论文地址:https://arxiv.org/abs/1901.08043 论文代码:https://github.com/xingyizhou/ExtremeNet 概述 ExtremeN ...

  8. 创建djangoapp

    1.python3 manage.py startapp goods 2.startapp users 3.启动django服务器 # make new migrationspython3 manag ...

  9. ImportError: No module named 'tkinter'

    环境说明: windows7.vscode1.33.1.python3.7.0. 解决方案: 通过安装程序单独卸载“tcl/tk and IDLE”------重新安装“tcl/tk and IDLE ...

  10. tomcat各文件夹及作用

    1.bin目录:这个文件夹包含的是启动/关闭tomcat的脚本 2.conf目录:主要是用来存放一些Tomcat的配置文件,都是一些.xml部署文件,其中重要的有: server.xml:是Tomca ...