Advertisement
double_trouble

Untitled

Aug 20th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <math.h>
  4.  
  5. using namespace std;
  6.  
  7. long a[10000];
  8.  
  9. int main()
  10. {
  11.     freopen("input.txt", "r", stdin);
  12.     freopen("output.txt", "w", stdout);
  13.     long a,b,c,y;
  14.     cin>>a>>b>>c;
  15.     long n=-1;
  16.     for (int i=1; i<36; i++)
  17.     {
  18.         long x=b*pow(i,a)+c;
  19.         if (x<=10000)
  20.         while (x>0)
  21.             {
  22.                 y+=x%10;
  23.                 x/=10;
  24.             }
  25.         if (y==i)
  26.         {
  27.             n++;
  28.             a[n]=x;
  29.         }
  30.     }
  31.     n++;
  32.     cout<<n<<endl;
  33.     for (int i=0; i<n; i++)
  34.         cout<<a[i]<<" ";
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement