#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
bool pali(int x)
{
int first=x;
int second=0;
while(x)
{
second=10*second+x%10;
x/=10;
}
return (first==second);
}
int32_t main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin>>n;
ll r=0LL;
for(int i=1;i<=n;i++)
{
int x;
cin>>x;
if(pali(x))
{
r+=x;
}
}
cout<<r<<"\n";
return 0;
}
/**
**/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
512 KB |
Output is correct |
3 |
Correct |
78 ms |
5240 KB |
Output is correct |
4 |
Correct |
110 ms |
7564 KB |
Output is correct |
5 |
Correct |
144 ms |
9976 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
47 ms |
1784 KB |
Output is correct |
4 |
Correct |
77 ms |
3228 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
47 ms |
1784 KB |
Output is correct |
4 |
Correct |
77 ms |
3228 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
384 KB |
Output is correct |
7 |
Correct |
76 ms |
3460 KB |
Output is correct |
8 |
Correct |
114 ms |
4108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
512 KB |
Output is correct |
3 |
Correct |
78 ms |
5240 KB |
Output is correct |
4 |
Correct |
110 ms |
7564 KB |
Output is correct |
5 |
Correct |
144 ms |
9976 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
47 ms |
1784 KB |
Output is correct |
9 |
Correct |
77 ms |
3228 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
76 ms |
3460 KB |
Output is correct |
13 |
Correct |
114 ms |
4108 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
7 ms |
640 KB |
Output is correct |
16 |
Correct |
98 ms |
4216 KB |
Output is correct |
17 |
Correct |
139 ms |
9080 KB |
Output is correct |
18 |
Correct |
160 ms |
10120 KB |
Output is correct |
19 |
Correct |
158 ms |
10236 KB |
Output is correct |
20 |
Correct |
155 ms |
10120 KB |
Output is correct |