結果

問題 No.792 真理関数をつくろう
ユーザー momoyuu
提出日時 2024-10-01 22:34:45
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,027 bytes
コンパイル時間 1,018 ms
コンパイル使用メモリ 94,716 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-01 22:34:47
合計ジャッジ時間 2,054 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
using ll = long long;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

//    // char a = '∧';
//     char b = '∨';
//     char c = '¬';
//     char d = '⊥';
//     char e = '⊤';

    int n;
    cin>>n;
    cout<<"A=";
    for(int i = 0;i<1<<n;i++){
        vector<int> q(n);
        int r;
        for(int j = 0;j<n;j++) cin>>q[j];;
        cin>>r;
        if(i!=0) cout<<"∧";
        if(r==1){
            for(int j = 0;j<n;j++){
                if(j==0) cout<<"(";
                else cout<<"∧";
                if(q[j]==0) cout<<"¬"<<"P_"<<j+1;
                else cout<<"P_"<<j+1;
            }
            cout<<")";
        }else{
            for(int j = 0;j<n;j++){
                if(j==0) cout<<"(";
                else cout<<"∨";
                if(q[j]==0) cout<<"¬"<<"P_"<<j+1;
                else cout<<"¬"<<"P_"<<j+1;
            }
            cout<<")";
        }
    }
    cout<<endl;
}   

0