#include<stdio.h> int main() { int n, k; while(scanf("%d %d", &n, &k) != EOF) { int kase = 0; int i = 0; while(n > 0) { n--; kase++; i++; if(i == k) { i = 0; n++; } } printf("%d\n", kase); } return 0; }
2024-03-19 13:19:10
#include<stdio.h> int main() { int n, k; while(scanf("%d %d", &n, &k) != EOF) { int kase = 0; int i = 0; while(n > 0) { n--; kase++; i++; if(i == k) { i = 0; n++; } } printf("%d\n", kase); } return 0; }