#include <iostream>
using namespace std;
int palindrom (int x)
{
int p=1,nr=0;
if (x%10==0) return 0;
while (x>=p)
{
p=p*10;
nr=nr*10+x%10;
if (nr==x) return 1;
x=x/10;
}
if (x==nr)
return 1;
return 0;
}
int n,i;
int unsigned long long s,a;
int main()
{
cin>>n;
for (i=1; i<=n; i++)
{
cin>>a;
if (palindrom(a)) s=s+a;
}
cout<<s;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
6 ms |
340 KB |
Output is correct |
3 |
Correct |
188 ms |
472 KB |
Output is correct |
4 |
Correct |
272 ms |
480 KB |
Output is correct |
5 |
Correct |
379 ms |
476 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
3 ms |
212 KB |
Output is correct |
3 |
Correct |
76 ms |
476 KB |
Output is correct |
4 |
Correct |
151 ms |
476 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
3 ms |
212 KB |
Output is correct |
3 |
Correct |
76 ms |
476 KB |
Output is correct |
4 |
Correct |
151 ms |
476 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
6 ms |
308 KB |
Output is correct |
7 |
Correct |
173 ms |
3200 KB |
Output is correct |
8 |
Correct |
186 ms |
3972 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
6 ms |
340 KB |
Output is correct |
3 |
Correct |
188 ms |
472 KB |
Output is correct |
4 |
Correct |
272 ms |
480 KB |
Output is correct |
5 |
Correct |
379 ms |
476 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
3 ms |
212 KB |
Output is correct |
8 |
Correct |
76 ms |
476 KB |
Output is correct |
9 |
Correct |
151 ms |
476 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
6 ms |
308 KB |
Output is correct |
12 |
Correct |
173 ms |
3200 KB |
Output is correct |
13 |
Correct |
186 ms |
3972 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
11 ms |
568 KB |
Output is correct |
16 |
Correct |
171 ms |
4100 KB |
Output is correct |
17 |
Correct |
367 ms |
8836 KB |
Output is correct |
18 |
Correct |
364 ms |
9856 KB |
Output is correct |
19 |
Correct |
409 ms |
9856 KB |
Output is correct |
20 |
Correct |
368 ms |
9904 KB |
Output is correct |