标签:
#include<stdio.h>
#include<math.h>
#include<iostream>
using namespace std;
int main()
{
int n,a[6],x,y,i,j;
//scanf("%d\n",&n);
cin>>n;
while(n--)
{
//scanf("%d%d",&x,&y);
cin>>x>>y;
for(i=x;i<=y;i++)
{
a[0]=i%10;
a[1]=i/10%10;
a[2]=i/100%10;
a[3]=i/1000%10;
a[4]=i/10000%10;
a[5]=i/100000%10;
int flag=1;
for(j=0;j<4;j++)
{
if(a[j]>6||a[j+1]>6||a[j+2]>6)
{
flag=0;
break;
}
if(a[j]==a[j+1]&&a[j+1]==a[j+2])
{
flag=0;
break;
}
if(fabs(double(a[j]-a[j+1]))>4||fabs(double(a[j+1]-a[j+2]))>4)
{
flag=0;
break;
}
}
if(flag)
printf("%.6d\n",i);
}
printf("\n");
}
}
标签:
原文地址:http://www.cnblogs.com/mycapple-zgs-111411/p/4619713.html