fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main () {
  5.  
  6. int t; cin >> t;
  7.  
  8. while (t--) {
  9.  
  10.  
  11. int n,k; cin >> n >> k;
  12.  
  13. for (int i=1; i<k; i++) {
  14.  
  15. cout << i << " ";
  16. }
  17.  
  18. int d= n-k;
  19.  
  20. int m=n;
  21. while (d--) {
  22.  
  23. cout << m << " ";
  24. m--;
  25. }
  26. }
  27. }
Success #stdin #stdout 0.01s 5288KB
stdin
1
6 2
stdout
1 6 5 4 3