这道题其实只需要模拟就好了
#include <iostream>
using namespace std;
int main()
{
int juga,jugb,n,t;
while(cin>>juga>>jugb>>n)
{
if(jugb == n)
{
cout<<"fill B"<<endl;
cout<<"success"<<endl;
continue;
}
if(juga == n)
{
cout<<"fill A"<<endl;
cout<<"pour A B"<<endl;
cout<<"success"<<endl;
continue;
}
t = 0;
while(t != n)
{
cout<<"fill A"<<endl<<"pour A B"<<endl;
t += juga;
if(t > jugb)
{
t -= jugb;
cout<<"empty B"<<endl<<"pour A B"<<endl;
}
}
cout<<"success"<<endl;
}
}