Submission #1074891

#TimeUsernameProblemLanguageResultExecution timeMemory
1074891raduvPalindromes (info1cup18_palindromes)C++17
100 / 100
88 ms10068 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...