fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. const int ROW = 2;
  6. const int COL = 2;
  7.  
  8. int get_rand_num(int n){
  9. return rand() % n;
  10. }
  11.  
  12. int main(){
  13. srand(time(NULL));
  14. cout << ROW << endl;
  15. for(int i = 0; i < ROW; i++){
  16. for(int j = 0; j < COL; j++){
  17. if((i == 0 && j == 0) || (i == (ROW - 1) && j == (COL - 1))) cout << '.';
  18. else{
  19. int toss = get_rand_num(2);
  20. if(toss) cout << '.';
  21. else cout << '#';
  22. }
  23. }
  24. cout << endl;
  25. }
  26.  
  27. cout << get_rand_num(ROW * COL) + 1 << endl;
  28. return 0;
  29. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
2
.#
#.
2