#include "bits/stdc++.h"
using namespace std;
#ifdef debug
#include "debug.hpp"
#else
#define dbg(...)
#define dbgx(x)
#define line()
#endif
#define int long long
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define size(x) (int)(x.size())
void _() {
int n;
cin >> n;
vi a(n + 1);
for (int i = 1; i <= n; ++i)
cin >> a[i];
auto check = [&](string s) -> bool {
for (int i = 0; i < size(s); ++i)
if (s[i] != s[size(s) - i - 1])
return false;
return true;
};
int ans = 0;
for (int i = 1; i <= n; ++i)
if (check(to_string(a[i])))
ans += a[i];
cout << ans << '\n';
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
// freopen("in.txt", "r", stdin);
int t = 1;
// cin >> t;
for (int cs = 1; cs <= t; ++cs) {
_();
}
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |