fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6.  
  7. int t, l, c;
  8. char p;
  9. cin >> t;
  10. while (t != 0) {
  11. cin >> l >> c;
  12. if (l == c) {
  13.  
  14. for (int i = 0; i < l; i++) {
  15. p = '*';
  16. cout << p;
  17. }
  18. cout << endl;
  19. for (int j = 2; j < l; j++) {
  20. p = '*';
  21. cout << p;
  22. for (int i = 2; i < c; i++) {
  23. p = '.';
  24. cout << p;
  25. }
  26. p = '*';
  27. cout << p;
  28. cout << endl;
  29. }
  30. for (int i = 0; i < l; ) {
  31. p = '*';
  32. cout << p;
  33. ++i;
  34. }
  35. cout<<endl;
  36.  
  37.  
  38. }
  39.  
  40. if(l!=c||l<c||c<l){
  41.  
  42. for (int i = 0; i < l; ) {
  43. for (int j = 0; j < c;) {
  44. p = '*';
  45. cout << p;
  46. j++;
  47. }
  48. ++i;
  49. cout<<endl;
  50.  
  51. }
  52.  
  53. }
  54. if (l == 2 && c == 2) {
  55.  
  56. for (int i = 0; i < l;) {
  57. for (int j = 0; j < c; j++) {
  58. p = '*';
  59. cout << p;
  60.  
  61. }
  62. ++i;
  63. cout << endl;
  64. }
  65. }
  66.  
  67.  
  68. --t;
  69. cout<<endl;
  70.  
  71. }
  72.  
  73. return 0;
  74. }
Success #stdin #stdout 0s 15240KB
stdin
1
1 1
stdout
*
*