其他分享
首页 > 其他分享> > 1368:对称二叉树(tree_c)

1368:对称二叉树(tree_c)

作者:互联网

对称二叉树

#include<iostream>
#include<cstring>
using namespace std;

int main(){
    string s;
    cin>>s;
    int len=s.length();
    if(!len)cout<<"Yes";
    else{
        int pt=1;
        while(pt<len){
            if(pt+1==len||s[pt]=='#'&&s[pt+1]!='#'||s[pt]!='#'&&s[pt+1]=='#')break;
            pt+=2;
        }
        if(pt<len)cout<<"No";
        else cout<<"Yes";
    }   
	return 0;
}

标签:std,int,tree,len,二叉树,对称,include,1368
来源: https://www.cnblogs.com/sxrekord/p/symmetric_binary_tree.html