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;
}
全部评论

相关推荐

政委qqq:这道题在算法竞赛里唯一考的就是高精度,但是只能难住C++这类语言,Python直接a+b秒天秒地
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务