记录编号 384232 评测结果 AAAAAAAAAA
题目名称 1368.[HAOI 2013]跑步训练 最终得分 100
用户昵称 kZime 是否通过 通过
代码语言 C++ 运行时间 0.000 s
提交时间 2017-03-17 19:27:29 内存使用 0.00 MiB
显示代码纯文本
/*kZime*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <algorithm>
#define MAXN
using namespace std;
inline int read() {
	int k = 0, f = 1; char c = getchar();
	for(; !isdigit(c); c = getchar())if(c == '-') f = -1;
	for(; isdigit(c); c = getchar()) k = k * 10 + c - '0';
	return k * f;
}
inline char in() {
	char c = getchar();
	for(; !isalpha(c); c = getchar());
	return c;
}

/*-----------------------------------------------------------------------------*/
int r[100233];
int v[4] , m, t;

int AC() {
#ifndef MYLAB
	freopen("HAOI2013T1.in", "r", stdin);
	freopen("HAOI2013T1.out", "w", stdout);
#else
	freopen("in.txt", "r", stdin);
#endif
	m = read();
	t = read();
	for(int i = 1; i <= 3; i++) {
		v[i] = read();
	}
	
	for(int i = 0; i < t; i++) {
		char c ;
	 	c = in();
		if(c == 'u')r[i] = 1; //1表示上坡 
		else if(c == 'f')r[i] = 2;
		else if(c == 'd')r[i] = 3;
	}
	
	int s = 0, step = 0;
	while(s <= m && step <= t) {
		if(r[step] != 2) {
			s += v[1] + v[3];
		}else s += v[2] + v[2];
		step++;
	}
	
	printf("%d",--step);
	
	return 0;
}
int HA = AC();
int main(){;}