This question provides a sharp formula X = B · S (X)*A*+ C, S (x) is the sum of the individual digits of X, and the formula value is found between 0-000000000. Obviously, the brute force enumeration definitely times out, and it takes one minute to traverse one side, therefore, we need to analyze the formula.

We can see that S (x) ^ A = (X-C)/B, that is, (x-C)/B must be an integer, so the loop can be written as for (INT I = C; I <1000000000; I + = B), but this optimization is far from enough.

The above logic is to traverse the value of X. Take a closer look at the formula. There is a s (x) ^ A in it, which indicates that the problem is that S (x) can be traversed ), in this way, the traversal range is reduced to 0-85. Why? The sum of the bits of the maximum value of 999999999 is 81, so for (INT I = 1; I <85; I ++) traverse S (x), then use X = S (x) ^ A * B + C to X, and then check whether the sum of all bits of X is = I. Here s (X) ^ a * B + C note that this value will exceed int, so long is used. During the game, WA is here, and the POW function is hard to use in codeforce, I handed it over to WA, and it also made me wa twice, jiong

#include<iostream>#include<stdio.h>#include<math.h>using namespace std;int tsum(int i){ int sum=0; while(i){ sum+=(i%10); i/=10; } return sum;}long long powd(int t,int n){ long long sum=1; for(int i=1;i<=n;i++) sum*=t; return sum;}int main(){ int a,b,c; while(~scanf("%d%d%d",&a,&b,&c)){ int cou=0; int aa[100000]; for(int i=1;i<85;i++){ long long t=powd(i,a); long long x=t*b+c; if(x>0 && x<1000000000 && tsum(x)==i){ aa[cou++]=x; } } printf("%d\n",cou); for(int i=0;i<cou;i++){ if(i==(cou-1)) printf("%d\n",aa[i]); else printf("%d ",aa[i]); } }}