//poj3672 上山 下山 平地 如何及时返回
#include <iostream>
using namespace std;
int main()
{
int m, t, u, f, d;
cin>>m>>t>>u>>f>>d;
char c;
int total = 0;
int k = 0;
for(int i = 0; i < t; i++)
{
cin>>c;
if(total <= m)
{
if(c == 'u')
total += u + d;
else if(c == 'f')
total += f * 2;
else if(c == 'd')
total += d + u;
k++;
}
}
cout<<k-1<<endl;
return 0;
}
poj3672
最新推荐文章于 2019-03-31 20:30:05 发布