Submission #1130163

#TimeUsernameProblemLanguageResultExecution timeMemory
1130163matthewPalindromes (info1cup18_palindromes)C++20
100 / 100
112 ms400 KiB
#include <stdio.h>

using ll = long long;

int ogl(int num) {
  int ret = 0;
  while(num > 0) {
    ret = ret * 10 + num % 10;
    num /= 10;
  }
  return ret;
}

bool is_palindrome(int num) {
  return ogl(num) == num;
}

int main() {
  int n;
  scanf("%d", &n);
  ll sum = 0;
  for(int i = 0; i < n; i++) {
    int num;
    scanf("%d", &num);
    sum += is_palindrome(num) * num;
  }
  printf("%lld\n", sum);

  return 0;
}

Compilation message (stderr)

palindromes.cpp: In function 'int main()':
palindromes.cpp:20:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |   scanf("%d", &n);
      |   ~~~~~^~~~~~~~~~
palindromes.cpp:24:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |     scanf("%d", &num);
      |     ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...