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

为什么总是OLE???

Posted by saintleonard at 2008-07-18 20:12:11 on Problem 2955
不知为什么,总是Output limitexceeded......
那位大虾帮个忙啊!不胜感激!


#include<iostream.h>
#include<string.h>
int main()
{
	int s=0;
	int m,n,i,j=0;
	char a[100],b[100];	
	cin>>a;
	while((a[0]!='e'||a[1]!='n'||a[2]!='d'))
	{
		n=strlen(a);
		s=0;j=0;
		for(i=0;i<n;i++)
		{
			if(j==0){b[j]=a[i];}
			else
			{
				if((a[i]=='(')||(a[i]=='['))b[j]=a[i];
				if(a[i]==')')
					for(m=i-1;m>=0;m--)
					{
						if(b[m]=='('){b[m]=0;s+=2;}
					}
			    if(a[i]==']')
					for(m=i-1;m>=0;m--)
					{
						if(b[m]=='['){b[m]=0;s+=2;}
					}				
			}
			j++;
		}
		cout<<s<<endl;
		cin>>a;
	}
	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