#include #define rep(i,n) for(int i=0;i> N >> D; int now = 1, cnt = 0; while (now <= N) { now += D; cnt++; } if (now > N + 1) { if ((now % N - 1) % D == 0) { cout << --cnt << endl; } else { cout << N - 1 << endl; } } else { cout << --cnt << endl; } }