7 solutions

  • 1
    @ 2026-10-4 14:43:59

    #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
    3
    Tags
    # Submissions
    72
    Accepted
    25
    Uploaded By