Submission #411776

#TimeUsernameProblemLanguageResultExecution timeMemory
411776AlexandraPalindromes (info1cup18_palindromes)C++14
100 / 100
134 ms9924 KiB
#include <iostream> #include <string> #include <vector> #include <cmath> #include <math.h> #include <algorithm> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); long long int n, a, resp=0; cin >> n; vector <int> digitos; for (int i=0; i<n; i++) { string num; cin >> num; bool palin = true; for (int j=0; j<num.size(); j++) { if (num[j] != num[num.size()-1-j]) { palin = false; break; } } if (palin==true) { resp += stoi(num); } } cout << resp; return 0; }

Compilation message (stderr)

palindromes.cpp: In function 'int main()':
palindromes.cpp:21:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |   for (int j=0; j<num.size(); j++) {
      |                 ~^~~~~~~~~~~
palindromes.cpp:14:19: warning: unused variable 'a' [-Wunused-variable]
   14 |  long long int n, a, resp=0;
      |                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...