5 solutions

  • -1
    @ 2026-7-13 14:09:41
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    	int l,r,a=0;
    	cin>>l>>r;
    	for(int i=l;i<=r;i++){
    		int ae[15]={};
    		int t=i;
    		while(t){
    			int g=t%10;
    			ae[g]++;
    			t/=10;
    		}
    		t=i;
    		int c=0;
    		while(t){
    			int g=t%10;
    			if(g!=ae[g]){
    				c++;
    			}
    			t/=10;
    		}
    		if(c==0){
    			a+=i;
    		}
    	}
    	cout<<a;
    	return 0;
    }
    

    Information

    ID
    2864
    Time
    1000ms
    Memory
    64MiB
    Difficulty
    3
    Tags
    # Submissions
    67
    Accepted
    21
    Uploaded By