2018年1月13日 星期六

UVA Q10346 - Peter's Smokes

#include<iostream>
#include<iomanip>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
unsigned long long int a,b,c;
while(cin>>a>>b){
    c=0;
    while(a>=b){
        c=c+b;
        a=a-b;
        a++;
    }
    cout<<c+a<<endl;
}


system("pause");
return 0;
}

沒有留言:

張貼留言