Submission #401220

#TimeUsernameProblemLanguageResultExecution timeMemory
401220victoriadPalindromes (info1cup18_palindromes)C++14
100 / 100
277 ms9924 KiB
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <utility> #include <queue> #include <map> #include <iomanip> #include <stack> #include <fstream> #include <assert.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); int n,a; string s; bool p=true; cin>>n; long long int x=0; for(int i=0;i<n;i++){ cin>>a; p=true; s=to_string(a); for(int k=0;k<s.size()/2+1;k++){ if(s[k]!=s[s.size()-1-k]){ p=false; break; } } if(p)x+=a; } cout<<x; return 0; }

Compilation message (stderr)

palindromes.cpp: In function 'int main()':
palindromes.cpp:31:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |    for(int k=0;k<s.size()/2+1;k++){
      |                ~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...