5 solutions

  • 1
    @ 2026-7-13 14:52:38
     #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int l,r,c=0;
        cin>>l>>r;
        for(int i=l;i<=r;i++)
        {
            if(i==1||i==22||i==122||i==212||i==221||i==333||i==1333||i==3133||i==3313||i==3331||i==4444)
            {
                c+=i;
            }
        }
        cout<<c;
        return 0; 
    }
    
    • 0
      @ 2025-7-15 10:04:08
      #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;
      
      • -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;
        }
        
        • -2
          @ 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;
          
          
          • -3
            @ 2025-8-13 15:51:22

            看到这个题解的人这辈子有了!

            • @ 2025-8-13 16:03:59
              #include<bits/stdc++.h>
              using namespace std;
              int l,r;
              int main(){
              	int sum=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){
              			sum+=i; 
              		}
              	}
              	cout<<sum;	
              	
              	return 0;
              }
              
          • 1

          Information

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