Submission #98108

# Submission time Handle Problem Language Result Execution time Memory
98108 2019-02-20T18:04:57 Z tushar_2658 Palindromes (info1cup18_palindromes) C++14
100 / 100
391 ms 12308 KB
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
#define file freopen("in.txt", "r", stdin);

const int maxn = 1e6 + 5;
ll arr[maxn], sum = 0;
int n;

bool check(ll n){
    string s = to_string(n);
    string s1 = s;
    reverse(s.begin(), s.end());
    return (s == s1);
}

int main(){
    //file
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%lld", &arr[i]);
    }
    for(int i=0; i<n; i++){
        if(check(arr[i]))sum += arr[i];
    }
    printf("%lld\n", sum);
}

Compilation message

palindromes.cpp: In function 'int main()':
palindromes.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
palindromes.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld", &arr[i]);
         ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 6 ms 512 KB Output is correct
3 Correct 198 ms 8500 KB Output is correct
4 Correct 244 ms 10104 KB Output is correct
5 Correct 333 ms 12032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 177 ms 5724 KB Output is correct
4 Correct 391 ms 11216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 177 ms 5724 KB Output is correct
4 Correct 391 ms 11216 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 8 ms 540 KB Output is correct
7 Correct 262 ms 9784 KB Output is correct
8 Correct 363 ms 12024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 6 ms 512 KB Output is correct
3 Correct 198 ms 8500 KB Output is correct
4 Correct 244 ms 10104 KB Output is correct
5 Correct 333 ms 12032 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 6 ms 384 KB Output is correct
8 Correct 177 ms 5724 KB Output is correct
9 Correct 391 ms 11216 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 8 ms 540 KB Output is correct
12 Correct 262 ms 9784 KB Output is correct
13 Correct 363 ms 12024 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 13 ms 896 KB Output is correct
16 Correct 192 ms 7452 KB Output is correct
17 Correct 382 ms 11500 KB Output is correct
18 Correct 340 ms 12308 KB Output is correct
19 Correct 341 ms 12276 KB Output is correct
20 Correct 327 ms 12284 KB Output is correct