比赛 2026初中综合小练习 评测结果 WAWWWWWWWWWWWWWWWWWW
题目名称 逻辑表达式 最终得分 5
用户昵称 运行时间 0.385 s
代码语言 C++ 内存使用 4.35 MiB
提交时间 2026-04-14 21:03:08
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
string s;
int main(){
    freopen("expr.in","r",stdin);
    freopen("expr.out","w",stdout);
    cin>>s;
    if(s[0]=='('){
        cout<<0;
    }
    else if(s.size()==3){
        if(s[1]=='|'){
            if(s[0]=1){
                cout<<1<<endl<<0<<" "<<1;
            }
            else{
                if(s[2]==1){
                    cout<<1<<endl<<0<<" "<<0;
                }
                else{
                    cout<<0<<endl<<0<<' '<<0;
                }
            }
            
        }
        if(s[1]=='&'){
            if(s[0]=0){
                cout<<0<<endl<<1<<" "<<0;
            }
            else{
                if(s[2]==0){
                    cout<<0<<endl<<0<<" "<<0;
                }
                else{
                    cout<<1<<endl<<0<<' '<<0;
                }
            }
            
        }
    }
}