Submission #882828

#TimeUsernameProblemLanguageResultExecution timeMemory
882828NintsiChkhaidzePalindromes (info1cup18_palindromes)C++17
100 / 100
255 ms14156 KiB
#include <bits/stdc++.h> #define s second #define f first #define ll long long #define pb push_back #define pii pair <int,int> using namespace std; const int N = 1e6 + 5,mod = 1e9 + 7; ll ans; int a[N]; signed main (){ ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL); int n; cin>>n; for (int i = 1; i <= n; i++){ cin >> a[i]; int old = a[i]; vector <int> vec; while (a[i] > 0){ vec.pb(a[i] % 10); a[i] /= 10; } int ch=1,len = vec.size(); for (int j =0;j < vec.size()/2;j++){ if (vec[j] != vec[len - 1 - j]) ch=0; } if (ch) ans += old; } cout<<ans; }

Compilation message (stderr)

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