2 2 4 3 0 0
3 5
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
int n,m;
while(cin>>n>>m)
{
if(n==0 && m==0) break;
int s=0;
while(n>=m)
{
s += n/m*m;
n=n%m+n/m;
}
cout<<s+n<<endl;
}
return 0;
}HDUJ 1555 How many days?,布布扣,bubuko.com
原文地址:http://blog.csdn.net/hyccfy/article/details/38264317