#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. 树莓派 Raspbian

    备注,从右往左分别是:无线鼠标一个, HDMI转VGA接口一个,网线一根,小米充电宝电源线一个.树莓派Pi 3 一台,包括读卡器一个+32G class10 SD卡一块.最后俩个U盘作为备用里面有Ar ...

  2. Linux环境下完成远程系统迁移

    一.基础 了解: netcat是个计算机网络公用程式,用来对网络连线TCP或者UDP进行读写.nc命令是netcat命令的简称,都是用来设置路由器.netcat 在2001年insecure.org对 ...

  3. (转)windows下VMware-workstation中安装CentOS

    windows下VMware-workstation中安装CentOS   windows下VMware-workstation中安装CentOS,可以分两部分,安装虚拟机和安装CentOS虚拟机.具 ...

  4. 使用私有git仓库备份服务器脚本和配置文件

    1. 创建私有git仓库 服务器端配置: # 安装 git yum -y install git # 创建 git 用户 useradd git # 创建私有仓库数据存储目录 mkdir /git_b ...

  5. 3、TensorFlow基础(一) 设计思想与编程模型

    1.TensorFlow系统架构 如图为TensorFlow的系统架构图: TensorFlow的系统架构图,自底向上分为设备层和网络层.数据操作层.图计算层.API层.应用层,其中设备层和网络层,数 ...

  6. oracle navicat 可视化操作进行数据的修改

    在进行oracle数据库中的数据操作编辑时,需要小心.oracle内置的安全机制是无处不在,并且很有必要存在的. 使用navicat对oracle中数据进行select操作时,查询出的结果是只读的,这 ...

  7. system命令

    服务查看 查看所有服务运行状态: service --status-all chkconfig --list 查看单个服务的运行状态 service sshd status 查看启动状态,是否开机自动 ...

  8. 2.阿里实人认证 .net 准备工作2 转换demo

    1.引入阿里的SDK 2. 搬一下java 的代码 DefaultProfile profile = DefaultProfile.GetProfile( "cn-hangzhou" ...

  9. Java - 冒泡排序的优化算法(尚学堂第七章数组)

    import java.util.Arrays; public class TestBubbleSort2 { public static void main(String[] args) { int ...

  10. sizeof(数组名) 与 数组长度

    int a[] = {1, 2, 3, 4}; cout << sizeof(a); //16 char b[] = "abc"; cout << size ...