結果
問題 |
No.792 真理関数をつくろう
|
ユーザー |
![]() |
提出日時 | 2024-10-01 22:39:02 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,065 bytes |
コンパイル時間 | 925 ms |
コンパイル使用メモリ | 94,684 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-01 22:39:04 |
合計ジャッジ時間 | 1,788 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 4 |
other | WA * 22 |
ソースコード
#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(r==1){ if(i!=0) cout<<"∨"; 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{ if(i!=0) cout<<"∧"; 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; }