题目
import java.util.Deque;
import java.util.LinkedList;
import java.util.Scanner;
public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int n = sc.nextInt();sc.nextLine();char[] c = sc.nextLine().toCharArray();Deque<Character> dq = new LinkedList<>();//使用Dequefor(int i=0;i<c.length;i++) {if(c[i] == '(') {dq.addFirst(c[i]);}else {//如果一开始进来的是)肯定不行直接return if(dq.isEmpty()) {System.out.println("No");return ;}dq.removeFirst();}}if(!dq.isEmpty()) {System.out.println("No");}else {System.out.println("Yes");}}
}