Submission

Status:

-PTTT-TTTT

Subtask/Task Score:

10/100

Score: 10

User: Tjeez

Problemset: Strobogrammatic Numbers

Language: cpp

Time: 1.109 second

Submitted On: 2026-10-11 17:01:00

#include <bits/stdc++.h>
using namespace std;
int main(){
	int cnt=0;
	int l,h ; cin>>l>>h;
	for (int i=l ; i<=h ; i++){
		bool x=true;
		string s=to_string(i);
		for (int j=0 ; j<s.length(); j++){
			if (s[j]=='2'||s[j]=='3'||s[j]=='4'||s[j]=='5'||s[j]=='7'){
				x=false;
				break;
			}
		}
		if (x){			
			string f=s;
			reverse(s.begin(),s.end());
			
			for (int k=0 ; k<s.length(); k++){
				if (s[k]=='6') s[k]='9';
				else if (s[k]=='9') s[k]='6';

			}
			cout<<s<<" "<<f<<"\n";
			int a,b;
			a=stoi(s),b=stoi(f);
			if(f==s){
				cnt++;
			}
			
		}
	}
	cout<<cnt;
}