#include #include #define MAX 10001 char a[MAX]; void rep(int n, int *tt, int *ww) { for (int t=n; t>0; t--) { for (int w=n/t; w>0; w--) { if (memcmp(a+n+1-(t-1)*w, a+n+1-t*w, (t-1)*w)==0) { *tt = t; *ww = w; return; } } } // not reached } int main() { int z = 0; int o = 0; printf ("%d %d\n", 0, z-o); for (int n=1; n1) { a[n] = 0; int t0, w0; rep(n, &t0, &w0); a[n] = 1; int t1, w1; rep(n, &t1, &w1); // printf("# t=%d w=%d -- t=%d w=%d\n", t0, w0, t1, w1); if (t0t1) { v = 1; } else if (w0w1) { v = 1; } else { break; } } a[n] = v; if (v) { o++; } else { z++; } printf("%d %d\n", n, z-o); fflush(stdout); } return 0; }