烟头瓶子

这题老师讲过,跟空瓶子一样

#include <stdio.h>

int main() {

      int n,k,t;

      while(scanf("%d%d",&n,&k)==2)等于2代表输入都成功

     {t=n; while(t>=k) { n+=t/k; t=t%k+t/k; } printf("%d\n",n);

}

return 0;

} http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=15&pro

posted @ 2013-02-28 18:54  L kill  阅读(121)  评论(0编辑  收藏  举报