0分蒟蒻求救!!
查看原帖
0分蒟蒻求救!!
1370353
datobimake楼主2024/6/29 18:17
#include<bits/stdc++.h>
using namespace std;
stack<char> s;
string cinema;
int f = 0;
int main()
{
    cin >> cinema;
    for(int i = 0; i < cinema.length(); i++)
    {
        if(cinema[i]  == '(')
            s.push(cinema[i]);
        else if(s.empty() && cinema[i] == ')')
        {
            f = 1;
            break;
        }
        else if(cinema[i] == '@')
            break;
        else if(!s.empty() && cinema[i] == ')')
            s.pop();   
    }
    if(f == 0)
        cout << "yes";
    else
        cout << "no";
    return 0;
}
2024/6/29 18:17
加载中...