美文网首页
poj3672 数值模拟

poj3672 数值模拟

作者: 暖昼氤氲 | 来源:发表于2019-12-05 10:17 被阅读0次
/*
Time:2019.12.5
Author: Goven
type:模拟-数值 
ref:
*/
#include<iostream>

using namespace std;

int main()
{
    int M, T, U, F, D;
    cin >> M >> T >> U >> F >> D;
    char c;
    int i, tp1 = U + D, tp2 = F * 2;
    for (i = 0; i < T && M > 0; i++) {
        cin >> c;
        if (c == 'u' || c == 'd') M -= tp1;
        else M -= tp2;
    } 
    for (int j = i; j < T; j++) cin >> c;
    if (M < 0) i--;
    cout << i << endl; 
    return 0;
}

相关文章

网友评论

      本文标题:poj3672 数值模拟

      本文链接:https://www.haomeiwen.com/subject/aafdgctx.html