1 solutions
-
0
#include <bits/stdc++.h> using namespace std; int main(){ int l,r,sum=0; cin>>l>>r; for(int i=l;i<=r;i++){ int x = i; int arr[15]={0}; while(x>0){ //拆分x然后统计x中每一个数出现的次数 arr[x%10]++; x/=10; } x = i; int flag = 1; //1表示都出现了 while(x>0){ if(x%10 != arr[x%10]){ flag = 0; } x/=10; } if(flag==1){ sum+=i; } } cout <<sum; return 0; }
- 1
Information
- ID
- 158
- Time
- 1000ms
- Memory
- 64MiB
- Difficulty
- 6
- Tags
- # Submissions
- 59
- Accepted
- 17
- Uploaded By