Submission #1120294

#TimeUsernameProblemLanguageResultExecution timeMemory
1120294vjudge1Palindrome-Free Numbers (BOI13_numbers)C++17
28.33 / 100
1087 ms504 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {

  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  uint64_t a, b, ans = 0;
  cin >> a >> b;
  for (uint64_t i = a; i <= b; i++) {
    string str = to_string(i);
    char ok = true;
    for (size_t i = 0; i < str.size(); i++) {
      for (size_t j = 2; j <= str.size() - i; j++) {
        string substr = str.substr(i, j);
        string s1 = substr.substr(0, substr.size() / 2 + substr.size() % 2);
        string s2 = substr.substr(substr.size() / 2);
        reverse(s2.begin(), s2.end());
        if (s1 == s2) {
          ok = false;
          break;
        }
      }
      if (!ok) {
        break;
      }
    }

    if (ok) {
      ans++;
    }
  }
  cout << ans << '\n';
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...