3 solutions

  • 0
    @ 2025-8-22 15:50:35
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int l,r,all=0;
    	cin>>l>>r;
    	for(int i=l;i<=r;i++)
    	{
    		int a[15]={};
    		int t=i;
    		while(t)
    		{
    			int ge=t%10;
    			a[ge]++; 
    			t/=10;
    		}
    		t=i;
    		int cnt=0;
    		while(t)
    		{
    		    int ge=t%10;
    		    if(ge!=a[ge])
    		    {
    		    	cnt++;
    			}
    			t/=10;
    		}
    		
    		if(cnt==0)
    		{
    			all+=i;
    		}
    	}
    	cout<<all;
    	return 0;
    
    

    Information

    ID
    2864
    Time
    1000ms
    Memory
    64MiB
    Difficulty
    8
    Tags
    # Submissions
    16
    Accepted
    8
    Uploaded By