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

Ended

Participants:163

Verdict:Time Limit Exceeded
Score:50 / 100
Submitted:2017-12-24 12:52:11

Lang:Java

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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Stack;
/**
 *
 * @author Lenovo
 */
public class Main {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] argsthrows IOException{
        // TODO code application logic here
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 16);
        String inf = reader.readLine();
        inf = inf.replace(" """);
        System.out.println(handleInf(inf));
    }
    
    public static String handleInf(String inf) {
        ArrayList<Character> stack = new ArrayList<Character>();
        for(int i = 0i < inf.length(); i++) {
            char c = inf.charAt(i);
            if(c != ')' && c != '(') {
                stack.add(c);
                continue;
            }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX