| ||||||||||
| 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 | |||||||||
为什么不行呀 , 求助呀 ,#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator