# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1003208 | Nailuj_217 | Kemija (COCI22_kemija) | C++17 | 1 ms | 444 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (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... |