点击打开链接
#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; }