问题描述
小明为某机构设计了一个十字型的徽标(并非红十字会啊),如下所示:
..$$$$$$$$$$$$$..
..$...........$..
$$$.$$$$$$$$$.$$$
$...$.......$...$
$.$$$.$$$$$.$$$.$
$.$...$...$...$.$
$.$.$$$.$.$$$.$.$
$.$.$...$...$.$.$
$.$.$.$$$$$.$.$.$
$.$.$...$...$.$.$
$.$.$$$.$.$$$.$.$
$.$...$...$...$.$
$.$$$.$$$$$.$$$.$
$...$.......$...$
$$$.$$$$$$$$$.$$$
..$...........$..
..$$$$$$$$$$$$$..
..$...........$..
$$$.$$$$$$$$$.$$$
$...$.......$...$
$.$$$.$$$$$.$$$.$
$.$...$...$...$.$
$.$.$$$.$.$$$.$.$
$.$.$...$...$.$.$
$.$.$.$$$$$.$.$.$
$.$.$...$...$.$.$
$.$.$$$.$.$$$.$.$
$.$...$...$...$.$
$.$$$.$$$$$.$$$.$
$...$.......$...$
$$$.$$$$$$$$$.$$$
..$...........$..
..$$$$$$$$$$$$$..
对方同时也需要在电脑dos窗口中以字符的形式输出该标志,并能任意控制层数。
输入格式
一个正整数 n (n<30) 表示要求打印图形的层数。
输出格式
对应包围层数的该标志。
样例输入1
1
样例输出1
..$$$$$..
..$...$..
$$$.$.$$$
$...$...$
$.$$$$$.$
$...$...$
$$$.$.$$$
..$...$..
..$$$$$..
..$...$..
$$$.$.$$$
$...$...$
$.$$$$$.$
$...$...$
$$$.$.$$$
..$...$..
..$$$$$..
样例输入2
3
样例输出2
..$$$$$$$$$$$$$..
..$...........$..
$$$.$$$$$$$$$.$$$
$...$.......$...$
$.$$$.$$$$$.$$$.$
$.$...$...$...$.$
$.$.$$$.$.$$$.$.$
$.$.$...$...$.$.$
$.$.$.$$$$$.$.$.$
$.$.$...$...$.$.$
$.$.$$$.$.$$$.$.$
$.$...$...$...$.$
$.$$$.$$$$$.$$$.$
$...$.......$...$
$$$.$$$$$$$$$.$$$
..$...........$..
..$$$$$$$$$$$$$..
..$...........$..
$$$.$$$$$$$$$.$$$
$...$.......$...$
$.$$$.$$$$$.$$$.$
$.$...$...$...$.$
$.$.$$$.$.$$$.$.$
$.$.$...$...$.$.$
$.$.$.$$$$$.$.$.$
$.$.$...$...$.$.$
$.$.$$$.$.$$$.$.$
$.$...$...$...$.$
$.$$$.$$$$$.$$$.$
$...$.......$...$
$$$.$$$$$$$$$.$$$
..$...........$..
..$$$$$$$$$$$$$..
提示
请仔细观察样例,尤其要注意句点的数量和输出位置。
傻逼模拟题
char ans1[9][10] = { "..$$$$$..", "..$...$..", "$$$.$.$$$", "$...$...$", "$.$$$$$.$", "$...$...$", "$$$.$.$$$", "..$...$..", "..$$$$$.." }; struct ans{ char str[140][140]; }aa[30]; void OUT(int n){ rep(i,0,9) rep(j,0,9){ aa[1].str[i][j] = ans1[i][j]; } repf(i,2,n){ rep(j,0,9+4*(i-1)) rep(k,0,9+4*(i-1)) aa[i].str[j][k] = '.'; rep(j,2,2+9+4*(i-2)){ rep(k,2,2+9+4*(i-2)){ aa[i].str[j][k] = aa[i-1].str[j-2][k-2]; } } rep(j,2,2+9+4*(i-2)) aa[i].str[0][j] = '$'; /////////////////////////////// aa[i].str[1][2] = '$'; aa[i].str[1][2+9+4*(i-2)-1] = '$'; ////////////////////////////////// rep(j,2,2+9+4*(i-2)) aa[i].str[2+9+4*(i-2)+1][j] = '$'; /////////////////////////////// aa[i].str[2+9+4*(i-2)][2] = '$'; aa[i].str[2+9+4*(i-2)][2+9+4*(i-2)-1] = '$'; /////////////////////////////////////////// rep(j,3,2-1+9+4*(i-2)) aa[i].str[j][2+1+9+4*(i-2)] = '$',aa[i].str[j][2+9+4*(i-2)] = '.',aa[i].str[j][0] = '$',aa[i].str[j][1] = '.'; aa[i].str[2][0] = '$',aa[i].str[2][1] = '$'; aa[i].str[2][2] = '$'; aa[i].str[2+9+4*(i-2)-1][0] = '$',aa[i].str[2+9+4*(i-2)-1][1] = '$'; aa[i].str[2+9+4*(i-2)-1][2] = '$'; aa[i].str[2][2+9+4*(i-2)-1] = '$'; aa[i].str[2][2+9+4*(i-2)] = '$'; aa[i].str[2][2+9+4*(i-2)+1] = '$'; aa[i].str[2+9+4*(i-2)-1][2+9+4*(i-2)-1] = '$'; aa[i].str[2+9+4*(i-2)-1][2+9+4*(i-2)] = '$'; aa[i].str[2+9+4*(i-2)-1][2+9+4*(i-2)+1] = '$'; } rep(i,0,9+4*(n-1)) printf("%s ",aa[n].str[i]); } int main() { //freopen("in.txt","r",stdin); int n; while(cin>>n){ OUT(n); } return 0; }