poj2509

简单题

View Code
#include <iostream>
#include
<cstdlib>
#include
<cstring>
#include
<cstdio>
using namespace std;

int main()
{
//freopen("D:\\t.txt", "r", stdin);
int n, k;
while (scanf("%d%d", &n, &k) != EOF)
{
int ans = n + (n / (k - 1));
if (n % (k - 1) == 0)
ans
--;
printf(
"%d\n", ans);
}
return 0;
}
posted @ 2011-04-30 15:57  金海峰  阅读(173)  评论(0编辑  收藏  举报