Submission #401220

# Submission time Handle Problem Language Result Execution time Memory
401220 2021-05-09T15:57:08 Z victoriad Palindromes (info1cup18_palindromes) C++14
100 / 100
277 ms 9924 KB
#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

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 time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 5 ms 332 KB Output is correct
3 Correct 131 ms 5024 KB Output is correct
4 Correct 209 ms 7456 KB Output is correct
5 Correct 260 ms 9892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 98 ms 1688 KB Output is correct
4 Correct 187 ms 3144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 98 ms 1688 KB Output is correct
4 Correct 187 ms 3144 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 5 ms 336 KB Output is correct
7 Correct 170 ms 3364 KB Output is correct
8 Correct 202 ms 4000 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 5 ms 332 KB Output is correct
3 Correct 131 ms 5024 KB Output is correct
4 Correct 209 ms 7456 KB Output is correct
5 Correct 260 ms 9892 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 3 ms 332 KB Output is correct
8 Correct 98 ms 1688 KB Output is correct
9 Correct 187 ms 3144 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 5 ms 336 KB Output is correct
12 Correct 170 ms 3364 KB Output is correct
13 Correct 202 ms 4000 KB Output is correct
14 Correct 1 ms 316 KB Output is correct
15 Correct 9 ms 608 KB Output is correct
16 Correct 104 ms 4140 KB Output is correct
17 Correct 243 ms 8992 KB Output is correct
18 Correct 263 ms 9924 KB Output is correct
19 Correct 266 ms 9900 KB Output is correct
20 Correct 277 ms 9900 KB Output is correct