Advertisement
VictorXjoeY

Resulting code from the naive approach

Nov 15th, 2019
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <cstdio>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. // PLACE THE OUTPUT OF THE GENERATOR CODE HERE.
  7.  
  8. int main() {
  9.     int n, k;
  10.  
  11.     scanf("%d", &n);
  12.  
  13.     // Retrieving the number of unlucky numbers up to N.
  14.     for (k = 0; k < ans.size(); k++) {
  15.         if (ans[k] > n) {
  16.             break;
  17.         }
  18.     }
  19.  
  20.     // Printing all the unlucky numbers up to N in ascending order.
  21.     printf("%d\n", k);
  22.  
  23.     for (int i = 0; i < k; i++) {
  24.         printf("%d\n", ans[i]);
  25.     }
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement