Fork me on GitHub

Peter的烟

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int n,k,ans;
int main()
{
    cin>>n>>k;
    while(n>=k)
    {
        ans+=k;
        n=n-k+1;
    }
    ans+=n;
    printf("%d",ans);
}
posted @ 2017-09-24 17:48  primes  阅读(228)  评论(0编辑  收藏  举报