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 351200 at 2011-05-09 16:23:45 on Problem 2955
#include<iostream>
#include<string>
using namespace std ;
int main()
{
	
	string s ;
	while(cin>>s )
	{
		if(s=="end")
			break ;
		int i,j,len, k=0 ;
		len=s.length() ;
		for(i=0 ;i<len ;i++)
		{

			for(j=i+1 ;j<len ;j++)
			{
				if(s[i]=='('&& s[j]==')' )
				{
					k++ ;
					continue ;
				}
				if(s[i]=='[' && s[j]==']')
				{
					k++ ;
					continue ;
					
				}
			}
			
		}
		cout<<k<<endl ;
	}
		
		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