发布题解

wangjiajian  •  2年前


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stack>
using namespace std;

const int N = 260;
char bds[N];
stack<char> s;

int main(){
    scanf("%s",bds);
    int i=0;
    while(bds[i] != '@'){
        if(bds[i] == '(')
            s.push('(');
        else if(bds[i] == ')'){
            if(s.size() != 0)
                s.pop();
            else{    
                printf("NO");
                return 0;
            }
        }
        i++;
    }
    if(s.size() == 0)
        printf("YES");
    else
        printf("NO");
    return 0;
}

Comments:

请使用万能头文件<bits/stdc++.h>


ZZQ  •  2年前

请添加注释


mod998244353  •  2年前