fork download
  1. #include <iostream>
  2. #include <queue>
  3. using namespace std;
  4.  
  5. int main() {
  6. int t;
  7. cin >> t;
  8. while (t--) {
  9. int n;
  10. cin >> n;
  11. queue<long long> q;
  12. q.push(1);
  13.  
  14. while (n--) {
  15. long long front = q.front();
  16. q.pop();
  17.  
  18. cout << front << " ";
  19.  
  20. q.push(front * 10);
  21. q.push(front * 10 + 1);
  22. }
  23.  
  24. cout << endl;
  25. }
  26. return 0;
  27. }
  28.  
  29.  
Success #stdin #stdout 0.01s 5320KB
stdin
1
18
stdout
1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111 10000 10001 10010