- 守望者的逃离
- 2014-10-12 11:34:20 @
#include <iostream>
using namespace std;
int Time,MoFa,Sum;
bool Leave=false;
int main()
{
cin>>MoFa>>Sum>>Time;
int SUM=Sum,TIME=Time;
while( Time>0 )
{
if( MoFa>=10 )
{
MoFa-=10;
Time--;
Sum-=60;
if( Sum<=0 )
{
cout<<"Yes"<<endl;
cout<<TIME-Time<<endl;
Leave=true;
break;
}
continue;
}
int wait=(10-MoFa)/4+(10-MoFa)%4!=0;
int walk=(wait+1)*17;
if( walk>Sum || (wait>=3 && Time>=7 && Sum<=7*17) )
{
while( Time>=0 && Sum>0 )
{
Sum-=17;
Time--;
}
if( Sum<=0 )
{
cout<<"Yes"<<endl;
cout<<TIME-Time<<endl;
Leave=true;
}
break;
}
if( (wait>=3 && Time<7)|| wait>=Time )
{
while( Time>=0 && Sum>0 )
{
Sum-=17;
Time--;
}
if( Sum<=0 )
{
cout<<"Yes"<<endl;
cout<<TIME-Time<<endl;
Leave=true;
break;
}
break;
}
else
{
Time=Time-wait;
MoFa=MoFa+wait*4;
}
}
if( Leave==false )
{
cout<<"No"<<endl;
cout<<SUM-Sum<<endl;
}
return 0;
}