[Offer收割]编程练习赛41 register

Ended

Participants:163

Verdict:Wrong Answer
Score:0 / 100
Submitted:2017-12-24 14:18:22

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<iostream>
using namespace std;
void swap(char &a,char &b){
    char t;
    t=a;
    a=b;
    b=t;
}
int main(){
    string s;
    cin>>s;
    int len=s.length();
    int i=0,j=len-1,f1=0,f2=0,t1,t2,flag=0;
    
    while(i<len/2){
        if(s[i]!='(')
            ++i;
        else
            f1++;
        if(s[j]!=')')
            --j;
        else
            f2++;
        if(f1&&f2){
            f1=f2=0;
            flag++;
            if(flag%2==0){
                int T=i-t1;
            //  cout<<T<<endl;
                while(T--){
                    //cout<<T<<" "<<t1<<" "<<t2<<endl;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX