2021 Niu Ke Winter Holiday Algorithm Basic Training Camp 6 A. Palindrome bracket sequence counting (underworld question)

Title:

Insert picture description here

solution:

TMD, () is not a palindrome, (( is a palindrome,
so the legal bracket sequence must not meet the conditions.
When n=0, it outputs 1 and otherwise outputs 0.

There is enough underworld.

code:

#include <bits/stdc++.h>
using namespace std;
void solve(){
    
    
    int n;cin>>n;
    if(!n)cout<<1<<endl;
    else cout<<0<<endl;
}
signed main(){
    
    
    int T;cin>>T;
    while(T--){
    
    
        solve();
    }
    return 0;
}

Guess you like

Origin blog.csdn.net/weixin_44178736/article/details/114021508