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 |
为什么总是OLE???不知为什么,总是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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator