Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
357 B
0
Indexable
Never
#include <iostream>
#include <cmath>
using namespace std;
int main() {
	int a, b, c, d, e ,a1,a2;
	e = 0;
	d = 0;
	cin >> a >> b;
	for (int i = a; i < b+1; i++){
		c = i;
		while (c >= 10) {
			d += 1;
			c /= 10;
		}
		c = i;
		a1 = c / pow(10, d);
		a2 = c / int(pow(10, d - 1)) % 10;
		if (a1 == a2) e += 1;
		d = 0;
	}
	cout << e;
}