Submission

Status:

----------

Subtask/Task Score:

0/100

Score: 0

User: Win007

Problemset: บริษัททำความสะอาด

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-06 12:12:04

#include <bits/stdc++.h>
using namespace std;
void stringSwap(string &s){
    int x=0;
    int y=s.length()-1;
    while(x<=y){
        swap(s[x], s[y]);
        x++;
        y--;
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int a,b,x=0,y=0;;
    cin>>a>>b;
    for(int i=a; i<=b; i++){
        string s=to_string(i);
        string p=s;
        stringSwap(s);
        for(int j=0; j<s.length(); j++){
            if(s[j]=='6'){
                s[j]='9';
            }else if(s[j]=='9'){
                s[j]='6';
            }
            if((s[j]==p[j])&&((s[j]=='0')||(s[j]=='1')||(s[j]=='6')||(s[j]=='8')||(s[j]=='9'))){
                x+=1;
            }else{
                x+=0;
            }
        }
        if(x<s.length()){
            x=0;
        }else{
            x=1;
        }
        y+=x;
    }
    cout<<y;
}