fork(2) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. const string week[7] = {"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"};
  5. int main() {
  6. srand(4202265);
  7. int n =rand() % 20 + 1, m =rand() % 20 + 1;
  8.  
  9. cout << n << " " << m << endl;
  10. for (int i = 1; i <= n; i++) {
  11. vector<int> vec;
  12. for (int j = 1; j <= m; j++) vec.push_back(j);
  13.  
  14. for (int j = 1; j <= m; j++) {
  15. if (j != 1) printf(" ");
  16. int have = rand() % (int)vec.size();
  17. printf("%d", vec[have]);
  18. vec.erase(vec.begin() + have);
  19.  
  20. }
  21. puts("");
  22. }
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
6 3
1 2 3
2 3 1
1 2 3
3 1 2
2 3 1
2 3 1