๐Ÿ“ฆ ved015 / Codeforces-solution

๐Ÿ“„ splitthemultiset1300.cpp ยท 22 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#include<iostream>
using namespace std;
int solve(int n,int k){
    if(n == 1) return 0;
    int i = k;
    int count = 1;
    while(i < n){
        i += k - 1;
        count++;
    }
    return count;
}
int main(){
    int t;
    cin >> t;
    while(t--){
        int n,k;
        cin >> n >> k;
        cout << solve(n,k) << endl;
    }
    return 0;
}