| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
这样不行。。。AC 了。。但不是0ms#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define N 100005
int main(void)
{
char str[N];
int m,u,f,d;
int t;
int i;
int now=0;
scanf("%d%d%d%d%d",&m,&t,&u,&f,&d);
getchar();
for(i=0;i<t;i++)
{
str[i]=getchar();
getchar();
}
for(i=0;i<t;i++)
{
if(now>m)
break;
if(str[i]=='u'||str[i]=='d')
now+=(u+d);
else
now+=f<<1;
}
printf("%d\n",i-1);
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator