Submission
Status:
PPTTTTTTTT
Subtask/Task Score:
20/100
Score: 20
User: mocngaijakraila
Problemset: Strobogrammatic Numbers
Language: cpp
Time: 1.097 second
Submitted On: 2026-06-07 10:54:40
#include<bits/stdc++.h>
using namespace std;
#define ll long long
bool f(ll i, ll j, string t) {
while(i <= j) {
if((t[i] == '1' && t[j] == '1') || (t[i] == '0' && t[j] == '0') || (t[i] == '8' && t[j] == '8') || (t[i] == '6' && t[j] == '9') || (t[i] == '9' && t[j] == '6')) {
i++;
j--;
}
else {
return false;
}
}
return true;
}
int main() {
cin.tie(0)->sync_with_stdio(0);
ll l, u;
cin >> l >> u;
ll cnt = 0;
while(l <= u) {
auto t = to_string(l);
int i = 0, j = t.length()-1;
if(f(i, j, t)) cnt++;
l++;
}
cout << cnt;
return 0;
}