Submission #915804

#TimeUsernameProblemLanguageResultExecution timeMemory
915804andrei_iorgulescuPalindromes (info1cup18_palindromes)C++14
100 / 100
470 ms10068 KiB
#include <bits/stdc++.h> using namespace std; #define int long long bool palin(int x) { vector<int>dig; while (x != 0) { dig.push_back(x % 10); x /= 10; } for (int i = 0; i < dig.size(); i++) if (dig[i] != dig[dig.size() - 1 - i]) return false; return true; } signed main() { int n,sm = 0; cin >> n; for (int i = 1; i <= n; i++) { int x; cin >> x; if (palin(x) == true) sm += x; } cout << sm; return 0; }

Compilation message (stderr)

palindromes.cpp: In function 'bool palin(long long int)':
palindromes.cpp:15:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for (int i = 0; i < dig.size(); i++)
      |                     ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...