10346 - Peter's Smokes.c
#include<stdio.h>int main(){ int n,K,i,sum,l,p; while (scanf("%d%d",&n,&K)!=EOF) { int sum1=n; for(i=0;i<n;n=sum) { if(n<K) { break; } l=n/K; p=n%K; sum=l+p; sum1=sum1+l; } printf("%d\n",sum1); } return 0;}
10346 - Peter's Smokes UVA link
No comments:
Post a Comment