#include<bits/stdc++.h>
using namespace std;
bool checkpal(int x)
{
string s="";
while(x)
{
s+=char(x%10);x/=10;
}
int i=0,j=s.size()-1;
while(i<j)
{
if(s[i]!=s[j])return 0;
i++;j--;
}
return 1;
}
int n;
long long ans;
int main()
{
cin>>n;
for(int i=0;i<n;i++)
{
int k;
cin>>k;
if(checkpal(k))
{
ans+=k;
}
}
cout<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
7 ms |
492 KB |
Output is correct |
3 |
Correct |
240 ms |
5100 KB |
Output is correct |
4 |
Correct |
357 ms |
7532 KB |
Output is correct |
5 |
Correct |
478 ms |
9984 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
3 ms |
364 KB |
Output is correct |
3 |
Correct |
108 ms |
1772 KB |
Output is correct |
4 |
Correct |
220 ms |
3180 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
3 ms |
364 KB |
Output is correct |
3 |
Correct |
108 ms |
1772 KB |
Output is correct |
4 |
Correct |
220 ms |
3180 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
6 ms |
364 KB |
Output is correct |
7 |
Correct |
211 ms |
3296 KB |
Output is correct |
8 |
Correct |
260 ms |
4076 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
7 ms |
492 KB |
Output is correct |
3 |
Correct |
240 ms |
5100 KB |
Output is correct |
4 |
Correct |
357 ms |
7532 KB |
Output is correct |
5 |
Correct |
478 ms |
9984 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
3 ms |
364 KB |
Output is correct |
8 |
Correct |
108 ms |
1772 KB |
Output is correct |
9 |
Correct |
220 ms |
3180 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
6 ms |
364 KB |
Output is correct |
12 |
Correct |
211 ms |
3296 KB |
Output is correct |
13 |
Correct |
260 ms |
4076 KB |
Output is correct |
14 |
Correct |
1 ms |
364 KB |
Output is correct |
15 |
Correct |
15 ms |
620 KB |
Output is correct |
16 |
Correct |
194 ms |
4132 KB |
Output is correct |
17 |
Correct |
428 ms |
8940 KB |
Output is correct |
18 |
Correct |
526 ms |
9964 KB |
Output is correct |
19 |
Correct |
484 ms |
9964 KB |
Output is correct |
20 |
Correct |
480 ms |
9964 KB |
Output is correct |