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;
}

(Visited 26 times, 1 visits today)

About the Author:

Leave A Comment