- 守望者的逃离
- 2015-08-20 09:27:52 @
//Escape Greedy
#include<iostream>
using namespace std;
int m,s,t,s1,t1;
int main(void)
{
cin>>m>>s>>t;
t1=t;
s1=0;
while (m>=10 && s-s1>0 && t1>0)
{
m-=10;
s1+=60;
t1--;
}
while (m>=6 && s-s1>17 && t1>1)
{
m+=4-10;
s1+=60;
t1-=2;
}
while (m>=2 && s-s1>34 && t1>2)
{
m+=8-10;
s1+=60;
t1-=3;
}
while (s-s1>119 && t1>=7)
{
s1+=120;t1-=7;
}
while (t1>0 && s-s1>0) {t1--;s1+=17;}
if (s1>=s) { cout<<"Yes"<<endl; cout<<t-t1<<endl;}
else cout<<"No"<<endl<<s1<<endl;
return 0;
}
1 条评论
-
niyinchen LV 9 @ 2015-08-24 16:02:59
弱弱的问一句:本题正解不是 动态规划 吗
- 1