Advertisement
DidiMilikina

05. Cup

Oct 15th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.43 KB | None | 0 0
  1. //URL FOR THE TASK: https://judge.softuni.bg/Contests/Practice/Index/715#4
  2.  
  3.  
  4. #include <iostream>
  5. #include <string>
  6. using namespace std;
  7.  
  8. int main() {
  9.  
  10.     int number;
  11.     cin >> number;
  12.  
  13.     int width = number * 5;
  14.  
  15.     int first_dots = number;
  16.     int second_dots = number;
  17.     int first_sharps = 3 * number;
  18.  
  19.     for (int i = 0; i < number / 2; ++i)
  20.     {
  21.         cout << string(first_dots, '.')
  22.             << string(first_sharps, '#')
  23.             << string(second_dots, '.')
  24.             << endl;
  25.         first_dots++;
  26.         first_sharps -= 2;
  27.         second_dots++;
  28.     }
  29.  
  30.     int points_middle = width - first_dots - second_dots - 2;
  31.     for (int i = 0; i < number / 2 + 1; ++i)
  32.     {
  33.         cout << string(first_dots, '.')
  34.             << '#'
  35.             << string(points_middle, '.')
  36.             << '#'
  37.             << string(second_dots, '.')
  38.             << endl;
  39.         first_dots++;
  40.         second_dots++;
  41.         points_middle -= 2;
  42.     }
  43.  
  44.     first_dots--;
  45.     second_dots--;
  46.  
  47.     cout << string(first_dots, '.')
  48.         << string(number, '#')
  49.         << string(second_dots, '.')
  50.         << endl;
  51.  
  52.     first_dots -= 2;
  53.     second_dots -= 2;
  54.     for (int i = 0; i < number / 2; ++i)
  55.     {
  56.         cout << string(first_dots, '.')
  57.             << string(number + 4, '#')
  58.             << string(second_dots, '.')
  59.             << endl;
  60.     }
  61.  
  62.     int dots = (width - 10 )/ 2;
  63.     cout << string(dots, '.')
  64.         << "D^A^N^C^E^"
  65.         << string(dots, '.')
  66.         << endl;
  67.  
  68.     for (int i = 0; i < number / 2 + 1; ++i)
  69.     {
  70.         cout << string(first_dots, '.')
  71.             << string(number + 4, '#')
  72.             << string(second_dots, '.')
  73.             << endl;
  74.     }
  75.  
  76.     return 0;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement