Submission #1003193

#TimeUsernameProblemLanguageResultExecution timeMemory
1003193Nailuj_217Kemija (COCI22_kemija)C++17
0 / 50
0 ms348 KiB
#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); for (int i = 0; i < equation.size();) { multiplier = 1; if (isdigit(equation[i])) { multiplier = equation[i++] - '0'; } while (equation[i] != '+' && equation[i] != '-' && equation[i] != '/') { 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); i += 2; } if (equation[i] == '+') i++; } if (abc == firstabc) cout << "DA" << "\n"; else cout << "NE" << "\n"; } cout << flush; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:22:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         for (int i = 0; i < equation.size();) {
      |                         ~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...