0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 18:31:59 +00:00

46177 【LGR-087】洛谷 7 月月赛 Div.2

T185757: R53089204
T185756: R53117077 [26' Code]
This commit is contained in:
Baoshuo Ren 2021-07-14 19:12:38 +08:00 committed by Baoshuo Ren
parent 7afce147b3
commit 605d9549b3
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68
2 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,26 @@
#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
pair<char, int> 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;
}

View File

@ -0,0 +1,19 @@
#include <bits/stdc++.h>
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;
}