HDU6330-2018ACM暑假多校联合训练Problem L. Visual Cube

就是画个图啦

分三个平面去画orz

  1 #include <iostream>
  2 #include <cmath>
  3 #include <cstring>
  4 #include <algorithm>
  5 
  6 using namespace std;
  7 
  8 int mp[100][100];
  9 
 10 int main()
 11 {
 12     ios::sync_with_stdio(false);
 13     int t;
 14     cin >> t;
 15     while (t--)
 16     {
 17         for (int i = 0; i < 100; i++)
 18             for (int j = 0; j < 100; j++)
 19                 mp[i][j] = 0;
 20         int a, b, c;
 21         cin >> a >> c >> b;
 22         
 23         for (int i = 0; i <= b * 2; i++)
 24         {
 25             for (int j = 0; j <= a * 2; j++)
 26             {
 27                 if (i % 2 == 0)
 28                 {
 29                     if (j % 2 == 0)
 30                         mp[i][j] = 1;
 31                     else
 32                         mp[i][j] = 2;
 33                 }
 34                 else
 35                 {
 36                     if (j % 2 == 0)
 37                         mp[i][j] = 3;
 38                 }
 39             }
 40         }
 41         int num = 1;
 42         for (int i = b * 2 + 1; i <= (b + c) * 2; i++)
 43         {
 44             for (int j = num; j <= (a + c) * 2; j++)
 45             {
 46                 
 47                 if (i % 2 == 1)
 48                 {
 49                     if (j % 2 == 1)
 50                         mp[i][j] = 4;
 51                     
 52                 }
 53                 else
 54                 {
 55                     if (j % 2 == 1)
 56                         mp[i][j] = 2;
 57                     else
 58                         mp[i][j] = 1;
 59                 }
 60                 if ((j - num) == (a * 2))
 61                     break;
 62             }
 63             num++;
 64         }
 65         for (int i = 1; i <= 2 * b; i++)
 66         {
 67             int y = i;
 68             for (int j = a * 2 + 1; j <= (a + c) * 2; j++)
 69             {
 70                 if (i % 2 == 1)
 71                 {
 72                     if (j % 2 == 1)
 73                         mp[y][j] = 4;
 74                     else
 75                         mp[y][j] = 1;
 76                 }
 77                 else
 78                 {
 79                     if (j % 2 == 0)
 80                         mp[y][j] = 3;
 81                 }
 82                 y++;
 83             }
 84         }
 85         for (int i = (b + c) * 2; i >= 0; i--)
 86         {
 87             for (int j = 0; j <= (a + c) * 2; j++)
 88             {
 89                 if (mp[i][j] == 0)
 90                     cout << ".";
 91                 else if (mp[i][j] == 1)
 92                     cout << "+";
 93                 else if (mp[i][j] == 2)
 94                     cout << "-";
 95                 else if (mp[i][j] == 3)
 96                     cout << "|";
 97                 else
 98                     cout << "/";
 99             }
100             cout << endl;
101         }
102     }
103     return 0;
104 }

猜你喜欢

转载自www.cnblogs.com/qq965921539/p/9394214.html