标签:间隔 names const href AC swa des 工作 整数
http://acm.hdu.edu.cn/showproblem.php?pid=2074
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5+10; char zzt[maxn],wbd[maxn]; char pig[100][100]; int n; int cnt=0; void A(int x)//第 x 圈,最外第一圈 { //左上角是 a[x][x],右下角是 a[n-x+1][n-x+1] char cmz; if(x%2==0) cmz=zzt[0]; else cmz=wbd[0]; for(int i=x; i<=n-x+1; i++) pig[x][i]=cmz; for(int i=x; i<=n-x+1; i++) pig[n-x+1][i]=cmz; for(int i=x; i<=n-x+1; i++) pig[i][x]=cmz; for(int i=x; i<=n-x+1; i++) pig[i][n-x+1]=cmz; } int main() { while(~scanf("%d",&n)) { cnt++; if(cnt!=1) printf("\n"); scanf("%s%s",zzt,wbd); if(n==1) { printf("%c\n",zzt[0]); continue; } if(((n+1)/2)%2==1) swap(zzt[0],wbd[0]); for(int i=1; i<=(n+1)/2; i++) { A(i); } pig[1][1]=‘ ‘; pig[1][n]=‘ ‘; pig[n][1]=‘ ‘; pig[n][n]=‘ ‘; for(int i=1; i<=n; i++) { for(int j=1; j<=n; j++) { printf("%c",pig[i][j]); } printf("\n"); } } return 0; }
标签:间隔 names const href AC swa des 工作 整数
原文地址:https://www.cnblogs.com/zlrrrr/p/9246097.html