fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. void solve()
  5. {
  6. int n;
  7. cin >> n;
  8.  
  9. if(n % 2 == 1)
  10. {
  11. for(int i = 0; i < n; i++)
  12. cout << "1 ";
  13. cout << endl;
  14. return;
  15. }
  16.  
  17. cout << "2 6 ";
  18. for(int i = 0; i < n - 2; i++)
  19. cout << "4 ";
  20. cout << endl;
  21. }
  22.  
  23. int main() {
  24. // your code goes here
  25. int t;
  26. cin >> t;
  27.  
  28.  
  29. while(t--)
  30. solve();
  31. }
Success #stdin #stdout 0s 5320KB
stdin
3
1
4
3
stdout
1 
2 6 4 4 
1 1 1