Submission #1131512

#TimeUsernameProblemLanguageResultExecution timeMemory
1131512jpfr12Palindromes (info1cup18_palindromes)C++20
100 / 100
65 ms31660 KiB
#include <bits/stdc++.h>

typedef long long ll;
typedef unsigned long long int ull;
using namespace std;
const ll MOD = (ll)1e9+7;
int MAXN = 1e6;

//classes


//global
int N;
vector<string> vec;

bool isPalindrome(string& str){
  int left = 0, right = str.length()-1;
  while(left < right){
    if(str[left] != str[right]) return false;
    left++;
    right--;
  }
  return true;
}

ll convertNum(string& str){
  ll ans = 0;
  for(char& i: str){
    ans *= 10;
    ans += i-'0';
  }
  return ans;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  //ifstream fin("hps.in");
  //ofstream fout("hps.out");
  //stop
  cin >> N;
  ll sum = 0LL;
  vec.assign(N, "");
  for(string& i: vec){
    cin >> i;
    if(isPalindrome(i)){
      sum += convertNum(i);
    }
  }
  cout << sum << '\n';
  return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...