Submission
Status:
PPTTTTTTTT
Subtask/Task Score:
20/100
Score: 20
User: UNJE0o
Problemset: Strobogrammatic Numbers
Language: cpp
Time: 1.096 second
Submitted On: 2026-10-12 19:24:39
#include <bits/stdc++.h>
#define en '\n'
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
string w;
unsigned long long low,high,c = 0;
cin >> low >> high;
for(unsigned long long i = low;i <= high;i++){
w = to_string(i);
int len = w.size();
bool ok = true;
for(int j = 0;j < len/2 + len%2;j++){
if(w[j] == '1' && w[len-1-j] == '1') continue;
if(w[j] == '0' && w[len-1-j] == '0') continue;
if(w[j] == '8' && w[len-1-j] == '8') continue;
if(w[j] == '6' && w[len-1-j] == '9') continue;
if(w[j] == '9' && w[len-1-j] == '6') continue;
ok = false;
break;
}
if(ok) c++;
}
cout << c;
}