# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
644924 | 2022-09-25T14:22:13 Z | Iwanttobreakfree | Kemija (COCI22_kemija) | C++17 | 1 ms | 340 KB |
#include <iostream> #include <vector> using namespace std; int main() { string s; int n; cin >> n; while (n--) { cin >> s; bool sec = false; char last = '0'; int mult = 1; vector<int> num (26), num2 (26); for (int i = 0; i < s.size(); ++i) { if (s[i] == '+') { last = '0'; mult = 1; } else if (s[i] == '>') { sec = true; last = '0'; mult = 1; } else if ('0' <= s[i] and s[i] <= '9') { if (last == '0') mult = s[i]-'0'; else { if (sec) num2[s[i-1]-'A']+=mult*(s[i]-'1'); else num[s[i-1]-'A']+=mult*(s[i]-'1'); //cout << << '\n'; } } else if ('A'<=s[i] and s[i]<='Z'){ if (sec) num2[s[i]-'A'] += mult; else num[s[i]-'A']+=mult; last = s[i]; } } //for (int i = 0; i < 26; ++i) cout << num[i] << num2[i] << '\n'; if (num == num2) cout << "DA\n"; else cout << "NE\n"; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 296 KB | Output is correct |
2 | Correct | 1 ms | 296 KB | Output is correct |
3 | Correct | 1 ms | 296 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 296 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 296 KB | Output is correct |
2 | Correct | 1 ms | 296 KB | Output is correct |
3 | Correct | 1 ms | 296 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 296 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 300 KB | Output is correct |
23 | Correct | 0 ms | 212 KB | Output is correct |
24 | Correct | 1 ms | 212 KB | Output is correct |
25 | Correct | 1 ms | 212 KB | Output is correct |
26 | Correct | 1 ms | 296 KB | Output is correct |
27 | Correct | 1 ms | 300 KB | Output is correct |