// A slow, but acceptable solution #include using namespace std; int main(){ int Q, M, S, L; cin >> Q >> M >> S >> L; vector A(M); // Greedily allocate the Q's... for(int i=0;i 0;i=(i+1)%M, S--) A[i]++; // Now the largest computer is the answer (should be A[0]) cout << *max_element(begin(A), end(A)) << endl; }