Submission
Status:
PPTTT-TTTT
Subtask/Task Score:
20/100
Score: 20
User: Bune
Problemset: Strobogrammatic Numbers
Language: cpp
Time: 1.096 second
Submitted On: 2026-08-23 15:12:41
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define ll long long
#define pb push_back
int main() {
fastio
int l, h;
cin >> l >> h;
int cnt = 0;
for (int i = l; i <= h; i++) {
string s = to_string(i);
bool isValid = true;
for (int j = 0; j <= s.length() / 2; j++) {
if (!((s[j] == '1' && s[s.length() - 1 - j] == '1') || (s[j] == '0' && s[s.length() - 1 - j] == '0') || (s[j] == '8' && s[s.length() - 1 - j] == '8') || (s[j] == '6' && s[s.length() - 1 - j] == '9') || (s[j] == '9' && s[s.length() - 1 - j] == '6'))) {
isValid = false;
}
}
if (isValid) {
cnt++;
}
}
cout << cnt << '\n';
return 0;
}