#include <iostream>
using namespace std;
const double S = 10000;
const double MAX_Oil = 5000;
const double STEP = 1250;
class Airplane
{
public:
Airplane():m_ulCurOil(5000),m_ulAlreadyAir(0){}
void SetCurOil(double OilParam){m_ulCurOil = OilParam;}
double GetCurOil()const{return m_ulCurOil;}
void SetCurAlreadyAir(double AlreadyAirParam){m_ulAlreadyAir = AlreadyAirParam;}
double GetCurAlreadyAir()const{return m_ulAlreadyAir;}
private:
double m_ulCurOil;
double m_ulAlreadyAir;
};
Airplane g_Airplane;
void Fly()
{
Airplane l_Airplane_help_one;
Airplane l_Airplane_help_two;
Airplane l_Airplane_help_three;
bool OneIsFinishHelp = false;
bool TwoIsFinishHelp = false;
bool ThreeIsFinishHelp = false;
for (double i=STEP;i<=S;i+=STEP)
{
g_Airplane.SetCurOil(g_Airplane.GetCurOil() - STEP);
g_Airplane.SetCurAlreadyAir(i);
if (!OneIsFinishHelp)
{
l_Airplane_help_one.SetCurOil(l_Airplane_help_one.GetCurOil() - STEP);
}
if (!TwoIsFinishHelp)
{
l_Airplane_help_two.SetCurOil(l_Airplane_help_two.GetCurOil() - STEP);
}
if (!ThreeIsFinishHelp)
{
l_Airplane_help_three.SetCurOil(l_Airplane_help_three.GetCurOil() - STEP);
}
if (i == (S*0.125))
{
l_Airplane_help_one.SetCurOil(l_Airplane_help_one.GetCurOil() - MAX_Oil*0.25);
g_Airplane.SetCurOil(g_Airplane.GetCurOil() + MAX_Oil*0.25);
l_Airplane_help_two.SetCurOil(l_Airplane_help_two.GetCurOil() - MAX_Oil*0.25);
l_Airplane_help_three.SetCurOil(l_Airplane_help_three.GetCurOil() - MAX_Oil*0.25);
l_Airplane_help_one.SetCurOil(l_Airplane_help_one.GetCurOil() + MAX_Oil*0.25);
l_Airplane_help_one.SetCurOil(l_Airplane_help_one.GetCurOil() + MAX_Oil*0.25);
}
if (i == (S*0.25))
{
l_Airplane_help_one.SetCurOil(l_Airplane_help_one.GetCurOil() - MAX_Oil*0.25);
g_Airplane.SetCurOil(g_Airplane.GetCurOil() + MAX_Oil*0.25);
l_Airplane_help_two.SetCurOil(l_Airplane_help_two.GetCurOil() - MAX_Oil*0.25);
l_Airplane_help_three.SetCurOil(l_Airplane_help_three.GetCurOil() - MAX_Oil*0.25);
l_Airplane_help_one.SetCurOil(l_Airplane_help_one.GetCurOil() + MAX_Oil*0.25);
l_Airplane_help_one.SetCurOil(l_Airplane_help_one.GetCurOil() + MAX_Oil*0.25);
TwoIsFinishHelp = true;
ThreeIsFinishHelp = true;
}
if (i == (S*0.5))
{
g_Airplane.SetCurOil(g_Airplane.GetCurOil() + l_Airplane_help_one.GetCurOil());
l_Airplane_help_one.SetCurOil(0);
OneIsFinishHelp = true;
}
}
}
int main()
{
Fly();
cout << "飞机行程:" << g_Airplane.GetCurAlreadyAir() << endl;
cout << "飞机油量:" << g_Airplane.GetCurOil() << endl;
return 0;
}