# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1003208 | Nailuj_217 | Kemija (COCI22_kemija) | C++17 | 1 ms | 444 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define l long long
using namespace std;
array<l, 200> abc;
array<l, 200> firstabc;
int main() {
l t;
cin >> t;
string equation;
l multiplier, mult2;
while (t--) {
cin >> equation;
equation += "/";
memset(abc.begin(), 0, 199);
abc.fill(0);
firstabc.fill(0);
for (int i = 0; i < equation.size();) {
multiplier = 1;
if (isdigit(equation[i])) {
multiplier = equation[i++] - '0';
}
while (equation[i] != '+' && equation[i] != '-' && equation[i] != '/') {
if (isdigit(equation[i])) i++;
if (equation[i] == '/' || equation[i] == '+' || equation[i] == '-') break;
mult2 = 1;
if (isdigit(equation[i+1])) mult2 = equation[i+1] - '0';
abc[equation[i++] - 'A'] += multiplier * mult2;
}
if (equation[i] == '/') break;
if (isdigit(equation[i])) i++;
if (equation[i] == '-') {
firstabc = abc;
memset(abc.begin(), 0, 199);
abc.fill(0);
i += 2;
}
if (equation[i] == '+') i++;
}
if (abc == firstabc) cout << "DA" << "\n";
else cout << "NE" << "\n";
}
cout << flush;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |