变量j的值莫名变化(把样例喂进去可以看出)
里面可能有一些调试代码
#include<bits/stdc++.h>
using namespace std;
int l,r,L,R,k,a[50];
int main(){
cin >> l >> r >> L >> R >> k;
for(int i=L;i<=R;i++){
int cnt=0,p=i,si=0;
for(int j=l;j<=r;j++){
while(p){
a[++si]=p%j;
p/=j;
}
bool flag=1;
for(int p=1;p<=si-2;p++){
if(a[p]!=a[p+2]){
flag=0;
break;
}
}
if(flag) cnt++;
}
if(cnt>=k){
cout << i << endl;
for(int j=1;j<=si;j++) cout << a[j] << " ";
cout << endl;
}
}
return 0;
}