#include #include using namespace std; #define NO -1 #define YOU 0 #define ENE 1 #define SEN 0 #define KOU 1 int main(){ int N,K; int ywin=0; int turn=YOU; int winlose[10001]; cin>>N>>K; for(int j=0;j<=N+10;j++) winlose[j]=NO; winlose[0]=SEN; for(int j=0;j<=N;j++){ for(int k=1;k<=K;k++){ if(j+k<=N){ if(winlose[j]==SEN) winlose[j+k]=KOU; else winlose[j+k]=SEN; } } } if(winlose[N]==SEN) ywin++,turn=ENE; for(int i=1;i<1000;i++){ cin>>N>>K; if(turn==ENE) turn=YOU; else ywin++,turn=ENE; } cout<