제출 #1120610

#제출 시각아이디문제언어결과실행 시간메모리
1120610vjudge1Palindrome-Free Numbers (BOI13_numbers)C++17
42.50 / 100
1099 ms504 KiB
#include <bits/stdc++.h>
using namespace std;

int a, b, n;
uint16_t ans = 0;
string str;
size_t i, j, k, d, e;

int main() {

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

  cin >> a >> b;

  for (n = a; n <= b; n++) {
    str = to_string(n);

    for (i = 0; i < str.size(); i++) {
      for (j = 2; j <= str.size() - i; j++) {
        e = j / 2;
        d = i + e + j % 2;

        for (k = i; k < d; k++) {
          if (str[k] != str[i + i + e + j - k - 2]) {
            break;
          }

          if (k == d - 1) {
            goto next;
          }
        }
      }
    }

    ans++;

  next:
    continue;
  }

  cout << ans << '\n';
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...