标签:clu http visual 方式 a+b head -- 结果 头部
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
using namespace std;
int main(void) {
int t, a, b, c;
cin >> t;
while (t-- > 0) {
cin >> a >> b >> c;
for (int i = 1; i <= (2 * (b + c) + 1); i++) {
//if (i != 1)cout << endl;
//head
if (i % 2 == 1 && i <= (2 * b)) {
for (int j = 1; j <= 2*(b-i/2); j++) {
cout << ".";
}
for (int j = 2 * (b - i / 2) + 1; j <= 2 * (b - i / 2) + a * 2; j+=2) {
cout << "+-";
}
cout << "+";
if (b < c || i <= (2 * c + 1)) {
for (int j = 2 * (b - i / 2) + a * 2 + 2; j <= 2 * (a + b) + 1; j += 2) {
cout << ".+";
}
}
else
{
cout << ".";
for (int j = 1; j <= c; j++) {
cout << "+.";
}
for (int j = 2 * (b - i / 2) + a * 2 + 2*c+3; j <= 2 * (a + b) + 1; j++) {
cout << ".";
}
}
cout << endl;
continue;
}
if (i % 2 == 0 && i <= (2 * b)) {
for (int j = 1; j <= 2 * (b - i / 2)+1; j++) {
cout << ".";
}
for (int j = 2 * (b - i / 2) + 1; j <= 2 * (b - i / 2) + a * 2; j += 2) {
cout << "/.";
}
if (b < c ||i<=(2*c+1)) {
for (int j = 2 * (b - i / 2) + a * 2 + 2; j <= 2 * (a + b) + 1; j += 2) {
cout << "/|";
}
}
else
{
cout << "/";
for(int j=1;j<=c;j++){
cout << "|/";
}
for (int j = 2 * (b - i / 2) + a * 2+2*c+3; j <= 2 * (a + b) + 1; j++) {
cout << ".";
}
}
cout << endl;
continue;
}
//middle
if (i % 2 == 1 && i > (2 * b)&& i<=2*c+1) {
for (int j = 1; j <= 2 * a; j+=2) {
cout << "+-";
}
cout << "+";
for (int j = 2 * (a+1); j <= 2 * (a + b) + 1; j += 2) {
cout << ".+";
}
cout << endl;
continue;
}
if (i % 2 == 0 && i > (2 * b) && i <= 2 * c + 1) {
for (int j = 1; j <= 2 * a; j+=2) {
cout << "|.";
}
cout << "|";
for (int j = 2 * (a + 1); j <= 2 * (a + b) + 1; j += 2) {
cout << "/|";
}
cout << endl;
continue;
}
//bottom
if (i % 2 == 1 && i > (2 * c + 1)) {
for (int j = 1; j <= 2 * a; j+=2) {
cout << "+-";
}
cout << "+";
int k = (2 * (c + b) + 1 - i) / 2+1;
for (int j = 1; j <= k-1; j++) {
cout << ".+";
}
for (int j = 2 * a + 1 + 2 * k; j <= 2 * (a + b) + 2; j++) {
cout << ".";
}
cout << endl;
continue;
}
if (i % 2 == 0 && i > (2 * c + 1)) {
for (int j = 1; j <= 2 * a; j+=2) {
cout << "|.";
}
int k = (2 * (c + b) + 1 - i) / 2+1;
for (int j = 1; j <= k; j++) {
cout << "|/";
}
for (int j = 2 * a + 1 + 2 * k; j <= 2 * (a + b) + 1; j++) {
cout << ".";
}
cout << endl;
continue;
}
}
}
return 0;
}
标签:clu http visual 方式 a+b head -- 结果 头部
原文地址:https://www.cnblogs.com/FlyerBird/p/9403338.html