poj3672 97ms 水题

#include<cstdio>
using namespace std;
//easy
int main()
{
    int m,t,u,f,d,c;
    scanf("%d%d%d%d%d",&m,&t,&u,&f,&d);
    getchar();
    int ans = 0;
    int cost = 0;
    while(t--)
    {
        c = getchar();
        getchar();
        if(c=='u'||c=='d') cost+=u+d;
        else cost+= 2*f;
        if(cost<=m) ans++;
    }
    printf("%d\n",ans);
    return 0;
}
全部评论

相关推荐

点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务