hdu 1555 How many days? (模拟)

点击打开链接

#include<stdio.h>
#include<string.h>
int main()
{
    int m,k,cnt,day;
    while(scanf("%d%d",&m,&k)!=EOF&&m!=0||k!=0)
    {
        cnt=0;day=0;
        while(m>0)
        {
            m--;day++;cnt++;
            if(cnt==k)
            {m++;cnt=0;}
        }
        printf("%d\n",day);
    }
    return 0;
}


posted on 2012-09-02 09:24  Slege  阅读(104)  评论(0编辑  收藏  举报

导航