山东智趣岛论坛

标题: 公式中有小写字母、加减乘除、()组成,以@结尾,字母 [打印本页]

作者: guanzizhuo    时间: 2024-9-15 17:23
标题: 公式中有小写字母、加减乘除、()组成,以@结尾,字母

公式中有小写字母、加减乘除、()组成,以@结尾,总数不超过200个,()不超过20个,判断公式中小括号是否规范。
#include<bits/stdc++.h>
using namespace std;
int main(){
        string s;
        cin>>s;
        char a,b,d;
        int c;
        for(int i=0;i<=200;i++){
                d=s[i];
                if(d=="("){
                        c+1;
                }
                if(d==")"){
                        c-1;
                }
                if(a<0){
                        cout<<"no";
                        return 0;
                }
        }
        if(c=0){
                cout<<"yes";
        }else{
                cout<<"no";
        }
       
       
}






欢迎光临 山东智趣岛论坛 (https://abc.sdzqd.com/) Powered by Discuz! X3.3