您或许对题目的理解有点问题?
> 如果你从最左边的数字开始向右数最左边这个数(如果数到了最右边就回到最左边),你会停止在另一个新的数字(如果停在一个相同的数字上,这个数就不是循环数)。
> 在经过每个数字一次后回到起点的就是循环数。
by yhchank @ 2022-08-19 12:23:31
看一下我的
```
#include<bits/stdc++.h>
using namespace std;
int main(){
long long m;
cin>>m;
while(true){
m++;
bool flag=true;
int a[20]={};
int cnt[10]={};
//a[i]表示倒序储存第i位数字
//cnt[i]表示数字i出现了几次
long long x=m,sz=0;
while(x){
a[++sz]=x%10;
cnt[x%10]++;
x/=10;
}
if(cnt[0]>0) continue;
for(int j=1;j<=9;j++){
if(cnt[j]>1){
flag=false;
break;
}
}
if(flag==false) continue;
int b[20]={};
for(int i=1;i<=sz;i++) b[sz-i]=a[i];
int pos=0;
for(int j=1;j<=sz;j++){
pos+=b[pos];
pos%=sz;
if(--cnt[b[pos]]<0){
flag=false;
break;
}
}
if(pos!=0) flag=false;
if(flag){
cout<<m<<endl;
break;
}
}
return 0;
}
```
by CharlieLee @ 2022-08-19 17:18:42
@[CharlieLee](/user/745235) 十分感谢
by liujiafang @ 2022-11-26 07:47:06