poj 2586
贪心。
代码:
#include<iostream>
#include<fstream>
using namespace std;
void read(){
// ifstream cin("in.txt");
int i,j,k,s,t;
while(cin>>s>>t)
{
t=-t;
if(s*4+t<0)
{
if(10*s+2*t>0)
cout<<10*s+2*t<<endl;
else
cout<<"Deficit"<<endl;
}
else
if(3*s+2*t<0)
{
if(8*s+4*t>0)
cout<<8*s+t*4<<endl;
else
cout<<"Deficit"<<endl;
}
else
if(2*s+3*t<0)
{
if(6*s+6*t>0)
cout<<6*s+6*t<<endl;
else
cout<<"Deficit"<<endl;
}
else
if(s+4*t<0)
{
if(3*s+9*t>0)
cout<<3*s+9*t<<endl;
else
cout<<"Deficit"<<endl;
}
else
cout<<"Deficit"<<endl;
}
}
int main(){
read();
return 0;
}
浙公网安备 33010602011771号