daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4. #include <vector>
  5.  
  6. using namespace std;
  7.  
  8.  
  9. int main() {
  10.     int n = 1000001;
  11.     vector<bool> v;
  12.     v.reserve(n);
  13.     for (int i=1; i<n; i++)
  14.     {
  15.         int aux, aux2;
  16.         aux=i;
  17.         aux2=aux;
  18.         while (aux>0)
  19.         {
  20.             aux2 += aux%10;
  21.             aux /= 10;
  22.         }
  23.         v[aux2]=true;
  24.     }
  25.     for (int i=1; i<n; i++)
  26.     {
  27.         if (!v[i])
  28.             cout << i << endl;
  29.     }
  30.     return 0;
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top