Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:50留个念, scanf要吃掉\n很个性

Posted by TSERROF at 2012-08-31 16:23:25 on Problem 3672
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator