Submission #882828

# Submission time Handle Problem Language Result Execution time Memory
882828 2023-12-03T19:54:57 Z NintsiChkhaidze Palindromes (info1cup18_palindromes) C++17
100 / 100
255 ms 14156 KB
#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

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 time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 112 ms 7256 KB Output is correct
4 Correct 143 ms 10468 KB Output is correct
5 Correct 197 ms 13904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Correct 43 ms 3956 KB Output is correct
4 Correct 89 ms 7016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Correct 43 ms 3956 KB Output is correct
4 Correct 89 ms 7016 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
7 Correct 89 ms 7052 KB Output is correct
8 Correct 109 ms 8020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 112 ms 7256 KB Output is correct
4 Correct 143 ms 10468 KB Output is correct
5 Correct 197 ms 13904 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 43 ms 3956 KB Output is correct
9 Correct 89 ms 7016 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 3 ms 604 KB Output is correct
12 Correct 89 ms 7052 KB Output is correct
13 Correct 109 ms 8020 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 8 ms 852 KB Output is correct
16 Correct 77 ms 6376 KB Output is correct
17 Correct 176 ms 12544 KB Output is correct
18 Correct 191 ms 13924 KB Output is correct
19 Correct 255 ms 13796 KB Output is correct
20 Correct 202 ms 14156 KB Output is correct