From 605d9549b32a1eefcf024dce739ae030d660bd5d Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Wed, 14 Jul 2021 19:12:38 +0800 Subject: [PATCH] =?UTF-8?q?46177=20=E3=80=90LGR-087=E3=80=91=E6=B4=9B?= =?UTF-8?q?=E8=B0=B7=207=20=E6=9C=88=E6=9C=88=E8=B5=9B=20Div.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit T185757: R53089204 T185756: R53117077 [26' Code] --- Luogu/contest/46177/T185756/T185756.cpp | 26 +++++++++++++++++++++++++ Luogu/contest/46177/T185757/T185757.cpp | 19 ++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 Luogu/contest/46177/T185756/T185756.cpp create mode 100644 Luogu/contest/46177/T185757/T185757.cpp diff --git a/Luogu/contest/46177/T185756/T185756.cpp b/Luogu/contest/46177/T185756/T185756.cpp new file mode 100644 index 00000000..bc64d84a --- /dev/null +++ b/Luogu/contest/46177/T185756/T185756.cpp @@ -0,0 +1,26 @@ +#include + +using namespace std; + +const int mod = 998244353; + +pair a[100005]; +int n, ans = -0x3f3f3f3f, sum; + +int main() { + cin >> n; + for (int i = 0; i < n; i++) { + cin >> a[i].first >> a[i].second; + } + sort(a, a + n); + do { + sum = 0; + for (int i = 0; i < n; i++) { + sum = a[i].first == '+' ? sum + a[i].second : sum * a[i].second; + } + sum %= mod; + ans = max(sum, ans); + } while (next_permutation(a, a + n)); + cout << ans % mod << endl; + return 0; +} diff --git a/Luogu/contest/46177/T185757/T185757.cpp b/Luogu/contest/46177/T185757/T185757.cpp new file mode 100644 index 00000000..537b244b --- /dev/null +++ b/Luogu/contest/46177/T185757/T185757.cpp @@ -0,0 +1,19 @@ +#include + +using namespace std; + +int a1, b1, c1, d1, a2, b2, c2, d2; + +int main() { + cin >> a1 >> b1 >> c1 >> d1 >> a2 >> b2 >> c2 >> d2; + if (a1 == a2 && b1 == b2 && c1 == c2 && d1 == d2) { + cout << "Yes" << endl; + } else if (a1 > 0 && b1 > 0 && c1 > 0 && d1 > 0 && a2 > 0 && b2 > 0 && c2 > 0 && d2 > 0) { + cout << "No" << endl; + } else if (!a1 + !b1 + !c1 + !d1 == 1 && d1 == 0) { + cout << "No" << endl; + } else { + cout << "Yes" << endl; + } + return 0; +}