#include <bits/stdc++.h>
using namespace std;
bool palindrome (string & s) {
int l = 0, r = (int)s.size() - 1;
while (l <= r) {
if (s[l] != s[r]) return false;
l++; r--;
}
return true;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int n, x, sum = 0;
vector<int> vi;
vector<string> vs;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x;
vi.push_back(x);
vs.push_back(to_string(x));
}
for (int i = 0; i < n; i++) {
if (palindrome(vs[i])) sum += vi[i];
}
cout << sum << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
316 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
2 ms |
1036 KB |
Output is correct |
3 |
Correct |
69 ms |
21340 KB |
Output is correct |
4 |
Correct |
134 ms |
42428 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
2 ms |
1036 KB |
Output is correct |
3 |
Correct |
69 ms |
21340 KB |
Output is correct |
4 |
Correct |
134 ms |
42428 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
4 ms |
1544 KB |
Output is correct |
7 |
Correct |
120 ms |
41440 KB |
Output is correct |
8 |
Correct |
145 ms |
43404 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
316 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |