5 solutions

  • 2
    @ 2025-2-28 20:03:33
    #include<bits/stdc++.h>
    using namespace std;
    bool check(int x)
    {
    	vector<int> v;
    	while(x)
    	{
    		int ge=x%9;
    		v.push_back(ge);
    		if(ge%2==0)
    		{
    			return false;
    		}
    		x/=9;
    	}
    	vector<int> v1=v;
    	reverse(v1.begin(),v1.end());
    	if(v1==v)
    	{
    		return true;
    	}
    	return false;
    }
    int main()
    {
    	int n,m;
    	cin>>n>>m;
    	int cnt=0;
    	for(int i=n;i<=m;i++)
    	{
    		if(check(i))
    		{
    			cnt++;
    		}
    	}
    	cout<<cnt;
    	return 0;
    }
    

    Information

    ID
    680
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    5
    Tags
    # Submissions
    66
    Accepted
    22
    Uploaded By