UCV2013C

UCV2013C

#include<iostream>
using namespace std;

int main()
{
unsigned long long d,f,b,m,p,p1,p2;
while(true)
{
cin>>d>>f>>b>>m;
if(d==0||f==0||b==0||m==0)
break;
p=f*(f+1)/2 + 1;
p1=p*b;
p2=p1+m;
if(p2>d)
{
cout<<"The firm is trying to bankrupt Farmer Cream by "<<p2-d<<" Bsf."<<endl;
}
else
{
cout<<"Farmer Cream will have "<<d-p1<<" Bsf to spend."<<endl;
}
}
return(0);
}

No comments:

Post a Comment