UVA 10346 - Peter's Smokes Shipu Ahamed - 01 Sep 2020 Problem PDFSolution:#include int main() { int a,n,k; while(scanf("%d %d",&n,&k)==2 && k>1) { a=n; while(n>=k) { a=a+(n/k); n=(n/k)+(n%k); } printf("%d\n",a); } return 0; } https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/10346/10346.cpp