Submission

Status:

PPTTTTTTTT

Subtask/Task Score:

20/100

Score: 20

User: peilin

Problemset: Strobogrammatic Numbers

Language: cpp

Time: 1.097 second

Submitted On: 2026-09-23 21:42:38

#include<iostream>
#include<string>
using namespace std;

int main() {
	long long low, high;
	cin >> low >> high;
	
	int ans=0;
	for(long long i=low; i<=high; i++) {
		string s=to_string(i);
		string t= "";
		
	
		for(int j=s.size()-1; j>=0; j--) {
			if(s[j]=='0') t+='0';
			else if(s[j]=='1') t+='1';
			else if(s[j]=='6') t+='9';
			else if(s[j]=='8') t+='8';
			else if(s[j]=='9') t+='6';
			else t+='x';
		}
		if(s==t)
		ans++;
	}
	cout << ans;
	
	return 0;
}