#include #include using namespace std; #define MN 1001 #define ME (MN*MN) int N,K; #define KK ((1<mx) { mx=i; printf("colored %d of %d\n",i,nv); } if(i==nv) { dump(); exit(0); } int j,X=0; for(j=A[i];jdeg[y] : x > y; } int main(int ac, char** av) { N=(ac>1)?atoi(av[1]):100; K=(ac>2)?atoi(av[2]):3; int i,j,x,y,s,p; for(x=3;x<=N;x++) R[x-1][x]=R[x][x-1]=1; for(x=2;x<=N;x++)for(s=x+2,p=2*x;s<2*x&&p<=N;p+=x,s++) R[s][p]=R[p][s]=1; for(x=1;x<=N;x++) { for(y=1;y<=N;y++) deg[x]+=R[x][y]; if(deg[x] < K) delQ[dq1++]=x; } while(dq0