結果
問題 | No.792 真理関数をつくろう |
ユーザー |
![]() |
提出日時 | 2019-02-22 21:46:37 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,314 bytes |
コンパイル時間 | 668 ms |
コンパイル使用メモリ | 92,288 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-25 07:56:28 |
合計ジャッジ時間 | 1,503 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 2 |
other | AC * 8 WA * 14 |
ソースコード
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; #define sz size() #define pb push_back #define mp make_pair #define fi first #define se second #define all(c) (c).begin(), (c).end() #define rep(i,a,b) for(ll i=(a);i<(b);++i) #define per(i,a,b) for(ll i=b-1LL;i>=(a);--i) #define clr(a, b) memset((a), (b) ,sizeof(a)) #define ctos(c) string(1,c) #define print(x) cout<<#x<<" = "<<x<<endl; #define MOD 1000000007 string ntos(long long n){ string s; stringstream ss; ss << n; ss >> s; return s; } int main(){ ll n; cin>>n; ll c = 0; string s = "A="; rep(i,0,pow(2,n)){ string s1 = "("; vector<ll> v; rep(j,1,n+1){ ll a; cin>>a; if(a)s1+="P_"+ntos(j); else s1+="¬P_"+ntos(j); if(j!=n)s1+="∧"; else s1+=")"; } ll a; cin>>a; if(a==1){ if(i!=0)s+="∨"; s+=s1; c++; } } if(c==0){ cout << "A=⊥" << endl; } else if(c==pow(2,n)){ cout << "A=⊤" << endl; } else{ cout << s << endl; } return 0; }