Submission #931081

#TimeUsernameProblemLanguageResultExecution timeMemory
931081hugsfromadictoPalindromes (info1cup18_palindromes)C++14
100 / 100
216 ms17820 KiB
#pragma GCC optimize("O3") #include <bits/stdc++.h> #define int long long using namespace std; const int mxN = 1e6+1; int a[mxN]; bool isp(int n) { vector<int>v; while(n) { v.push_back(n%10); n/=10; } for(int i = 0; i < v.size(); ++i) { if(v[i] != v[v.size() - i - 1]) { return false; } } return true; } void _() { int n,sum = 0; cin >> n; for(int i = 0; i < n; ++i) { cin >> a[i]; if(isp(a[i])) sum += a[i]; } cout << sum; } main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int tc = 1; //cin>>tc; while(tc--) { _(); } }

Compilation message (stderr)

palindromes.cpp: In function 'bool isp(long long int)':
palindromes.cpp:16:22: 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]
   16 |     for(int i = 0; i < v.size(); ++i)
      |                    ~~^~~~~~~~~~
palindromes.cpp: At global scope:
palindromes.cpp:41:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   41 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...