Submission

Status:

PPTTT-TTTT

Subtask/Task Score:

20/100

Score: 20

User: Win007

Problemset: Strobogrammatic Numbers

Language: cpp

Time: 1.095 second

Submitted On: 2025-10-06 09:33:15

#include <bits/stdc++.h>
using namespace std;
bool stroCheck(string s){
    vector <char> vec;
    for(int i=s.length()-1; i>=0; i--){
        if(s[i]=='1'){
            vec.push_back('1');
        }else if(s[i]=='0'){
            vec.push_back('0');
        }else if(s[i]=='6'){
            vec.push_back('9');
        }else if(s[i]=='9'){
            vec.push_back('6');
        }else if(s[i]=='8'){
            vec.push_back('8');
        }else{
            return 0;
        }
    }
    vector <char> cev;
    for(char i : s){
        cev.push_back(i);
    }
    for(int i=0; i<vec.size(); i++){
        if(vec[i]!=cev[i]){
            return 0;
        }
    }
    return 1;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a,b,n=0;
    cin>>a>>b;
    for(int i=a; i<=b; i++){
        if(stroCheck(to_string(i))==1){
            n++;
        }
    }
    cout<<n;
}