| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
O(∩_∩)O哈哈~这样暴力也能过啊!#include<iostream>
#include<algorithm>
#define MAX 302
using namespace std;
int a[MAX],temp[MAX];
int main()
{
int T,n,i,j;
cin>>T;
while(T--)
{
bool flag=true;
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
if(n==1)
{
cout<<1<<endl;
flag=false;
}
if(flag)
{
for(j=1;;j++)
{
for(i=0;i<n;i++)
temp[i]=a[i]%j;
sort(temp,temp+n);
for(i=1;i<n;i++)
if(temp[i-1]==temp[i])
break;
if(i==n)
break;
}
cout<<j<<endl;
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator