Submission #1074891

# Submission time Handle Problem Language Result Execution time Memory
1074891 2024-08-25T16:07:11 Z raduv Palindromes (info1cup18_palindromes) C++17
100 / 100
88 ms 10068 KB
#include <bits/stdc++.h>

using namespace std;
int ispalindrome(int x){
  int cx, nr;
  cx = x;
  nr = 0;
  while( x > 0 ){
    nr = nr * 10 + x % 10;
    x /= 10;
  }
  return (nr == cx);
}
int main()
{
    int n, i, x;
    long long ans;
    scanf("%d", &n);
    ans = 0;
    for ( i = 0; i < n; i++ ){
      scanf("%d", &x);
      ans += ispalindrome(x) * x;
    }
    printf("%lld\n", ans);
    return 0;
}

Compilation message

palindromes.cpp: In function 'int main()':
palindromes.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
palindromes.cpp:21:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |       scanf("%d", &x);
      |       ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 58 ms 5148 KB Output is correct
4 Correct 66 ms 7508 KB Output is correct
5 Correct 88 ms 10004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 28 ms 1700 KB Output is correct
4 Correct 50 ms 3156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 28 ms 1700 KB Output is correct
4 Correct 50 ms 3156 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 44 ms 3364 KB Output is correct
8 Correct 55 ms 4024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 58 ms 5148 KB Output is correct
4 Correct 66 ms 7508 KB Output is correct
5 Correct 88 ms 10004 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 28 ms 1700 KB Output is correct
9 Correct 50 ms 3156 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 44 ms 3364 KB Output is correct
13 Correct 55 ms 4024 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 3 ms 604 KB Output is correct
16 Correct 35 ms 4248 KB Output is correct
17 Correct 80 ms 9044 KB Output is correct
18 Correct 88 ms 10016 KB Output is correct
19 Correct 88 ms 10068 KB Output is correct
20 Correct 88 ms 9884 KB Output is correct