#include<bits/stdc++.h> using namespace std; int main() { int n,k,temp,sum; while(cin>>n>>k) { temp=n; while(n>=k) { temp=temp+(n/k); n=n/k + (n%k); } cout<<temp<<endl; } }
Saturday, August 27, 2016
UVa 10346 - Peter's Smokes
Labels:
UVA Solution
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Thank you for commenting. Please wait for response :)