제출 #1294511

#제출 시각아이디문제언어결과실행 시간메모리
1294511JohanPalindrome-Free Numbers (BOI13_numbers)C++20
35.83 / 100
1097 ms584 KiB
#include<bits/stdc++.h>
using namespace std;
bool pol(string s){
  for(int i = 0; i < s.size(); i++){
    if(s[i] != s[s.size() - i - 1])
      return false;
  }
  return true;
}
bool ok(long long x){
  string s = to_string(x);
  int n = s.size();
  for(int i = 0; i < n; i++){
    if(s[i] == s[i + 1] or s[i] == s[i + 2])
      return false;
  }
  return true;
}
int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long a, b, ans = 0;
  cin >> a >> b;
  for(int i = a; i <= b; i++){
    ans += ok(i);
  }
  cout << ans << "\n";
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...