Zoj2965 WrongAnswer求解
#include"stdio.h"#include"string.h"#define max 800 long seven(long x){ long i,j,a[max],z=1,count=0; for(i=1;i<max;i++) if(i%7==0||i/100==7||i/10%10==7||i%10==7) { count++; a[j]=i; j++; } if(x==1) { printf("7\n"); return 0; } for(j=2;j<=count;j++) { if(a[j]-a[j-1]==1) z++; else z=1; if(z==x) { printf("%d\n",a[j-x+1]); return 0; } }}int main(){ long t,r,u; scanf("%d",&t); if(t<1||t>100) return 0; for(r=0;r<t;r++) { scanf("%d",&u); seven(u); }}