| ||||||||||
| 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 | |||||||||
Re:50留个念, scanf要吃掉\n很个性In Reply To:50留个念, scanf要吃掉\n很个性 Posted by:xjtudaniel at 2009-09-12 11:23:22 #include <cstdio>
int main()
{
int M,T,Up,Flat,Down;
while(scanf("%d%d%d%d%d",&M,&T,&Up,&Flat,&Down)!=EOF)
{
int time=0,ans=0;
char ch;
ch=getchar();
for(int i=0;i!=T;++i)
{
scanf("%c%*c",&ch);
if(ch=='u' || ch=='d')time+=(Up+Down);
else if(ch=='f')time+=2*Flat;
if(time<=M)++ans;
}
printf("%d\n",ans);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator