Home > Back-end >  The small white daily asking
The small white daily asking

Time:12-01

Do today oj accomplish this, the compiled code but can't run, the question is where to ask Daniel, this have what good idea (always can't write just slightly in the
# include & lt; Iostream>
using namespace std;

//determine whether j for Self - Number
{int getD (int j)
Int sum=0, k=0;
For (int I=1; iSum=I;
While (I/(10 * k) % 10!=0) {
The sum +=I/(10 * (k++)) % 10;
}
If (sum==j) {
return 0;
}
}
return 1;
}

Int main () {
Int n=0, k=0, t=1;
Int a [5001], [10000001] b;
Cin & gt;> N & gt;> k;
Cin & gt;> A, [1].
Int Max=a, [1].//input the largest subscript
For (int I=2; i<=k; I++) {
Cin & gt;> A, [I].
If (a [I] & gt; Max)
Max=a, [I].
}
For (int j=1; J<=n; J++) {
If (t & gt; Max) {//when calculate the Self - Number Number exceeds largest subscript, directly out
break;
}
If (getD (j)) {
B [t++]=j;//to the desires of the Self - Number in the b array
}
}
For (int I=1; i<=k; I++) {
Cout & lt; }
return 0;
}
  • Related