제출 #1120238

#제출 시각아이디문제언어결과실행 시간메모리
1120238vjudge1Palindrome-Free Numbers (BOI13_numbers)C++11
3.75 / 100
1083 ms508 KiB
#include <bits/stdc++.h>
#define GOOD_LUCK ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define int long long
#define itn int
#define Int int
#define INF -1000000
#define MOD 1000000007
#define endl "\n"
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
using namespace std;

int temp;

bool check(int n) {
	string a = to_string(n);
	string c = a;
	int x = a.size();
	string b = a;
	reverse(b.begin(), b.end());
	string d = b;
	if (a == b) return false;
	for (int i=1; i < x-1; i++) {
		a = a.substr(1);
		b = b.substr(0, x - i);
		if (a == b) return false;
	}
	a = c;
	b = d;
	for (int i=1; i < x-1; i++) {
		d = d.substr(1);
		c = c.substr(0, x - i);
		if (c == d) return false;
	}
	return true;
}

signed main() {
	
	GOOD_LUCK
	
    int t;
	t = 1;
//	cin >> t;
    while (t--) {
    	int a, b;
    	cin >> a >> b;
    	int cnt=0;
    	for (int i=a; i <= b; i++) {
    		if (check(i)) cnt++;
		}
		cout << cnt;
	}

    return 0;
}
// Problem C
// by Ekber_Ekber
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...