#include <cstdio> #include <iostream> using namespace std; long long m,t; int u,f,d,n; char s; int main() { cin>>m>>n>>u>>f>>d; u+=d; f*=2; //去加回的距离一起算 for (int i=1;i<=n;++i) { cin>>s; if (s=='u' || s=='d') t+=u; //若为坡,直接加 else t+=f; if (t>m) { cout<<i-1; //直到超过秒数 return 0; } } if (t<=m) cout<<n; return 0; }
3
30
2015
30
2015