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

大家看看,我的程序怎么回事????

Posted by tzj115 at 2007-07-26 13:38:05 on Problem 3282
In Reply To:Re:You can assume it is in a reasonable range. Posted by:Bedivere at 2007-07-24 14:00:42
# include <iostream.h>
# include <string.h>
# include <stdio.h>

int kk=1;

int main()
{
	long n,l,m,car;
	char s[8];
	int i=0;
	char ss;
	long count;

	cin>>n;
	while(n--)
	{
		cin>>l>>m;
		l*=100;
		long lei=0;
		long flag=0;
		ss='l';/////////////
		count=0;
		long mm=m;//////////////
		//++m;
		while(m)
		{
			cin>>car>>s;

			if(ss!=s[0] && mm==m)
			{
				ss='r';
				//lei+=car;
				flag=1;//////////////
			}
			if(ss==s[0])
			{
				lei+=car;
				if(m==1)
				{
					long yu=lei%l;
					if(yu)
						count+=2*(lei/l+1)-1;
					else
						count+=2*(lei/l)-1;
					if(flag)////////////////////////
						count++;
					ss=s[0];
					//lei=car;
					flag=0;
				}
			}
			else  
			{
		
				long yu=lei%l;
				if(yu)
					count+=2*(lei/l+1)-1;
				else
					count+=2*(lei/l)-1;
				if(flag)////////////////////////
					count++;
				ss=s[0];
				lei=car;
				flag=0;
			}
			m--;
		}
		cout<<++i<<"\t"<<count<<"\n";
	}
	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