Submission #96029

#TimeUsernameProblemLanguageResultExecution timeMemory
96029alextodoranPalindromes (info1cup18_palindromes)C++14
100 / 100
449 ms10020 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; int n; ll s; vector <int> c; int main() { cin >> n; for(int i = 1; i <= n; i++) { int e; cin >> e; int e1 = e; c.clear(); while(e) { c.push_back(e % 10); e /= 10; } bool ok = 1; for(int i = 0; i < c.size() / 2; i++) if(c[i] != c[c.size() - i - 1]) { ok = 0; break; } s += ok * e1; } cout << s << "\n"; return 0; }

Compilation message (stderr)

palindromes.cpp: In function 'int main()':
palindromes.cpp:28:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = 0; i < c.size() / 2; 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...