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

Ended

Participants:163

Verdict:Output Limit Exceeded
Score:0 / 100
Submitted:2017-12-24 13:53:54

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<stdio.h>
#include<iostream>
#include<string>
#include<vector>
using  namespace std;
int main(){
    string str;
    cin>>str;
    
    int l = 0, r = str.size()-1;
    while(l<r){
        while(l<r && str[l] != '('){
            l++;            
        }
        while(l<r && str[r] != ')'){
            r--;
        }
        
        l++;r--;
        if(l>=r){
            break;
        }
        
        int x = l, y = r;
        while(x<y){
            char ch = str[x];
            str[x] = str[y];
            str[y] = ch;
            
            
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX