#include<stdio.h>
int func(int [],int);
int n;
int main()
{
int cas,n,a[100],yes[100],i,j;
scanf("%d",&cas);
if(cas<1||cas>100)
goto x;
for(i=0;i<cas;i+=1)
{
scanf("%d",&n);
for(j=0;j<n;j++)
{
scanf("%d",&a[j]);
}
yes[i]=func(a,n-1);
}
int g;
for(g=0;g<cas;g++)
{
if(yes[g]==1)
printf("yes\n");
else
if(yes[g]==0)
printf("no\n");
}
x:
return 0;
}
int func(int a[],int n)
{
int i,j;
for(i=0,j=n;i<j;i++,j--)
{
if(a[i]!=a[j])
return 0;
else if(a[i+1]-a[i]>1)
return 0;
else if(a[i]<0)
return 0;
else if(a[i+1]=a[i]<0)
return 0;
else if(a[1]<1||a[i]>7)
return 0;
}
return 1;
}
asked
02 Sep '17, 12:44
0★lord_axis
1
accept rate:
0%