Submission #541912

#TimeUsernameProblemLanguageResultExecution timeMemory
541912Alex_tz307Kemija (COCI22_kemija)C++17
50 / 50
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; void testCase() { string s; cin >> s; vector<vector<int>> f(2, vector<int>(26)); int index = 0, mul = 1; for (int i = 0; i < (int)s.size(); ++i) { if (isdigit(s[i])) { mul = s[i] - '0'; continue; } if (s[i] == '+') { mul = 1; continue; } if (s[i] == '-' || s[i] == '>') { index = 1; mul = 1; continue; } int ch = s[i] - 'A', nxtMul = 1; if (i + 1 < (int)s.size() && isdigit(s[i + 1])) { i += 1; nxtMul = s[i] - '0'; } f[index][ch] += mul * nxtMul; } if (f[0] == f[1]) { cout << "DA\n"; } else { cout << "NE\n"; } } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int tests; cin >> tests; for (int tc = 0; tc < tests; ++tc) { testCase(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...