Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals), problem: (D) High Load Solution In C/C++

#include <cstdio>
int main(){
int n, k;
scanf(“%d%d”, &n, &k);
int l = (n – 2) / k + 1;
printf(“%d\n”, 2 * l – ((n – 1) % k == 1));
for(int i = 2; i <= n; i++)
printf(“%d %d\n”, i, i <= k + 1 ? 1 : i – k);
return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *