Skip to content

Instantly share code, notes, and snippets.

@krofna
Last active October 27, 2016 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krofna/91cf6b12821d66434991c4f2636ee6b1 to your computer and use it in GitHub Desktop.
Save krofna/91cf6b12821d66434991c4f2636ee6b1 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <cstring>
#include <vector>
#include <string>
using namespace std;
int main()
{
int dubina, sirina;
cin >> dubina >> sirina;
vector<string> A;
A.resize(2 * 50 + 3 * 50 + 1);
for (int i = 0; i < A.size(); ++i)
A[i].resize(4 * sirina + 2 * dubina + 1, '.');
for (int z = 0; z < dubina; ++z)
{
for (int x = 0; x < sirina; ++x)
{
int in;
cin >> in;
for (int i = 0; i < in; ++i)
{
int xx = 2 * (dubina - z - 1) + 4 * x;
int yy = 2 * (dubina - z - 1) + 3 * i;
memcpy(&A[yy][xx], "+---+", 5);
memcpy(&A[yy + 1][xx], "| |/", 6);
memcpy(&A[yy + 2][xx], "| | +", 7);
memcpy(&A[yy + 3][xx], "+---+ |", 7);
memcpy(&A[yy + 4][xx + 1], "/ /|", 6);
memcpy(&A[yy + 5][xx + 2], "+---+", 5);
}
}
}
string empty(4 * sirina + 2 * dubina + 1, '.');
for (int y = 1; y <= A.size(); ++y)
if (A[A.size() - y] != empty)
cout << A[A.size() - y] << '\n';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment