码迷,mamicode.com
首页 > 其他好文 > 详细

马兰雏形

时间:2015-04-22 11:19:08      阅读:105      评论:0      收藏:0      [点我收藏+]

标签:

 1 #include<stdio.h>
 2 int main()
 3 {
 4     int desk[101][101]={0};
 5     int i,j,k,l,m,n;
 6     int hx,hy;
 7     scanf("%d%d",&m,&n);
 8     scanf("%d%d",&hx,&hy);
 9     desk[hx][hy]=-1;
10     if(hx+2<=m)   //优化算法什么的都去死吧 
11         if(hy+1<=n)    desk[hx+2][hy+1]=-1;
12         if(hy-1>=0) desk[hx+2][hy-1]=-1;
13     if(hx+1<=m)
14         if(hy+2<=n) desk[hx+1][hy+2]=-1;
15         if(hy-2>=0) desk[hx+1][hy-2]=-1;
16     if(hx-1>=0)  //复制粘贴大法好 
17         if(hy+2<=n) desk[hx-1][hy+2]=-1;
18         if(hy-2>=0) desk[hx-1][hy-2]=-1;
19     if(hx-2>=0)
20         if(hy+1<=n)    desk[hx-2][hy+1]=-1;
21         if(hy-1>=0) desk[hx-2][hy-1]=-1;
22     for(i=0;i<=m;i++)
23     {
24         for(j=0;j<=n;j++)
25             desk[i][j]==0?printf("#"):printf("X");
26         printf("\n");
27     }
28 }

 

马兰雏形

标签:

原文地址:http://www.cnblogs.com/KakagouLT/p/4446639.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!