Submission

Status:

PPxxxxxxxx

Subtask/Task Score:

20/100

Score: 20

User: mumumimi

Problemset: Strobogrammatic Numbers

Language: cpp

Time: 0.003 second

Submitted On: 2025-10-07 09:06:06

#include <iostream>
#include <string>
using namespace std;
int main(){
    long long low,high,n;
    cin >> low >> high ;
    n = high-low+1;
    string s[n];
    for(int i=0;i<n;i++){
        s[i] =  to_string(low+i) ;
    }
    long long count =0;
    for(int i=0;i<n;i++){
        string num = s[i];
        bool b = true;
        for(int l =0,r = num.length()-1;l<=r;l++,r--){
            char a=num[l] , c = num[r];
            if((a=='1'&&c=='1') ||
               (a=='0'&&c=='0') ||
               (a=='8'&&c=='8') ||
               (a=='6'&&c=='9') ||
               (a=='9'&&c=='6') ){
                continue;
               }else{
                b = false;
                break;
               }
        }
        if(b){
            count++;
        }
        
    }
    cout << count;
    
    
    
}