| ||||||||||
| 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 | |||||||||
请各位帮忙找找哪里错了~~#include<iostream>
int main(){
int m,t,u,f,d,p,q,n=0,work=1,flag=0;
char s;
scanf("%d%d%d%d%d",&m,&t,&u,&f,&d);
p=u+d;
q=2*f;
for(int i=0;i<t;i++){
scanf("%c",&s);
if(work){
if(s=='f')
n+=q;
else n+=p;
flag++;
if(n>m){
flag--;
work=0;
}
}
}
printf("%d\n",flag);
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator