17 solutions

  • 0
    @ 2022-1-1 22:10:59

    #include<bits/stdc++.h> using namespace std; char a[300]; int n1=0,n2=0;//判断左括号和右括号数量是否相等 int main(){ scanf("%s",a); stackstk; for(int i=0;a[i]!='@';i++){ if(a[i]'('){ stk.push(i); n1++; } if(a[i]')')n2++; if(!stk.empty()){ if(a[i]')')stk.pop(); } } if(stk.empty()&&(n1n2))printf("YES"); else printf("NO"); return 0; }

    Information

    ID
    289
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    5
    Tags
    # Submissions
    234
    Accepted
    87
    Uploaded By