#include #include #define MAX 10001 long long nb[MAX]; long long a[MAX]; int main() { memset(nb, 0, sizeof(nb)); a[0] = 0; for (int n=0; n=0; k--) { x ^= a[k]; w++; if (x < MAX && nb[x]=MAX) { break; } else { a[n+1] = nb[a[n]]; } } return 0; }