原题
简单图形打印,我写的太复杂了
#include<bits/stdc++.h>
using namespace std;
const int N = 110;
int n;
int main()
{
cin>>n;
for(int i = 1; i <= n; i ++ ){
for(int j = 1; j <= n; j ++ ){
if(j <= n / 2 && i <= n / 2){
if(j >= i){
if(i % 2){
cout<<"+";
}
else cout<<".";
}
else{
if(j % 2){
cout<<"+";
}
else cout<<".";
}
}
else if(i <= n / 2 && j >= n / 2){
if((n - j) >= i){
if(i % 2){
cout<<"+";
}
else{
cout<<".";
}
}
else{
if((n - j) % 2){
cout<<".";
}
else cout<<"+";
}
}
else if(i >= n / 2 && j <= n / 2){
if(j >= (n - i + 1)){
if((n - i) % 2){
cout<<".";
}
else cout<<"+";
}
else{
if(j % 2){
cout<<"+";
}
else cout<<".";
}
}
else if(i >= n / 2 && j >= n / 2){
if((n - j) >= (n - i + 1)){
if((n - i + 1) % 2){
cout<<"+";
}
else cout<<".";
}
else{
if((n - j + 1) % 2){
cout<<"+";
}
else cout<<".";
}
}
}
cout<<endl;
}
return 0;
}