xinzhiyong 发表于 2009-8-9 16:42

200908网友求助《棋盘覆盖问题》

本帖最后由 为你奋斗 于 2009-12-3 16:03 编辑

<FONT color="#000000"><FONT face="宋体">在一个</FONT><FONT face="Times New Roman">2k</FONT><FONT face="宋体">×</FONT><FONT face="Times New Roman">2k </FONT><FONT face="宋体">个方格组成的棋盘中,恰有一个方格与其他方格不同,称该方格为一特殊方格,且称该棋盘为一特殊棋盘。在棋盘覆盖问题中,要用图示的</FONT><FONT face="Times New Roman">4</FONT><FONT face="宋体">种不同形态的</FONT><FONT face="Times New Roman">L</FONT><FONT face="宋体">型骨牌覆盖给定的特殊棋盘上除特殊方格以外的所有方格,且任何</FONT><FONT face="Times New Roman">2</FONT><FONT face="宋体">个</FONT><FONT face="Times New Roman">L</FONT><FONT face="宋体">型骨牌不得重叠覆盖</FONT></FONT><BR><FONT color="#000000"></FONT><FONT color="#000000"></FONT><FONT color="#000000"></FONT><BR><FONT face="宋体"><FONT color="#000000">这是编写的程序</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">%</FONT><FONT face="宋体">残缺棋盘</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">board=zeros(100,100);</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">n=4;</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">size=2^n;</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">amount=0;</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">=cover(1,1,2,5,board,size,amount);</FONT></FONT><BR><FONT face="Times New Roman"><FONT color="#000000">board(1:size,1:size)</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">function =cover(i,j,k,l,board,size,amount)%(i,j)</FONT><FONT face="宋体">为左上角</FONT><FONT face="Times New Roman"> (k,l)</FONT><FONT face="宋体">残缺</FONT><FONT face="Times New Roman"> size</FONT><FONT face="宋体">为规模</FONT><FONT face="Times New Roman"> amount</FONT><FONT face="宋体">为片数</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">if size==1</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>return</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">end</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">amount=amount+1;</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">size=size/2;</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">if (k&lt;size+i)&amp;(l&lt;size+j)%</FONT><FONT face="宋体">残缺位于左上棋盘</FONT><FONT face="Times New Roman"><BR></FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">board(size+i-1,size+j)=amount;board(size+i,size+j)=amount;board(size+i,size+j-1)=amount;%</FONT><FONT face="宋体">放置</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">=cover(i,j,k,l,board,size,amount);=cover(i,j+size,size+i-1,j+size,board,size,amount);</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">=cover(size+i,size+j,size+i,size+j,board,size,amount);=cover(i+size,j,i+size,j+size-1,board,size,amount);</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">elseif (k&gt;=size+i)&amp;(l&lt;size+j)%</FONT><FONT face="宋体">残缺位于左下棋盘</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">board(size+i-1,size+j)=amount;board(size+i,size+j)=amount;board(size+i-1,size+j-1)=amount;%</FONT><FONT face="宋体">放置</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">=cover(i+size,j,k,l,board,size,amount);=cover(i,j+size,size+i-1,j+size,board,size,amount);</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">=cover(size+i,size+j,size+i,size+j,board,size,amount);=cover(i,j,i+size-1,j+size-1,board,size,amount);</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">elseif (k&lt;size+i)&amp;(l&gt;=size+j)%</FONT><FONT face="宋体">残缺位于右上棋盘</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">board(size+i,size+j-1)=amount;board(size+i,size+j)=amount;board(size+i-1,size+j-1)=amount;%</FONT><FONT face="宋体">放置</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">=cover(i,j+size,k,l,board,size,amount);=cover(i,j,i+size-1,j+size-1,board,size,amount);</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">=cover(size+i,size+j,size+i,size+j,board,size,amount);=cover(i+size,j,i+size,j+size-1,board,size,amount);</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">elseif (k&gt;=size+i)&amp;(l&gt;=size+j)%</FONT><FONT face="宋体">残缺位于右下棋盘</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">board(size+i,size+j-1)=amount;board(size+i-1,size+j)=amount;board(size+i-1,size+j-1)=amount;%</FONT><FONT face="宋体">放置</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">=cover(size+i,size+j,k,l,board,size,amount);=cover(i,j+size,size+i-1,j+size,board,size,amount);</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">=cover(i,j,i+size-1,j+size-1,board,size,amount);=cover(i+size,j,i+size,j+size-1,board,size,amount);</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">end</FONT></FONT><BR><FONT face="Times New Roman"><FONT color="#000000">end</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman">ns =</FONT></FONT><BR><FONT color="#000000"><FONT face="宋体">请问一下这个结果是什么意思呢?</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>Columns 1 through 13 </FONT></FONT><BR><FONT face="Times New Roman"><FONT color="#000000"> </FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>11<BR>11<BR>10<BR>10<BR>4<BR>4<BR>5<BR>5<BR>42<BR>42<BR>41<BR>41<BR>33</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>11<BR>8<BR>8<BR>10<BR>0<BR>4<BR>3<BR>5<BR>42<BR>39<BR>39<BR>41<BR>33</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>12<BR>8<BR>9<BR>9<BR>7<BR>3<BR>3<BR>6<BR>43<BR>39<BR>40<BR>40<BR>30</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>12<BR>12<BR>9<BR>2<BR>7<BR>7<BR>6<BR>6<BR>43<BR>43<BR>40<BR>23<BR>23</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>20<BR>20<BR>19<BR>2<BR>2<BR>14<BR>15<BR>15<BR>28<BR>28<BR>26<BR>26<BR>23</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>20<BR>18<BR>19 <BR>19<BR>14<BR>14<BR>13<BR>15<BR>28<BR>24<BR>24<BR>26<BR>35</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>22<BR>18<BR>18<BR>21<BR>17<BR>13<BR>13<BR>16<BR>25<BR>25<BR>24<BR>27<BR>38</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>22<BR>22<BR>21<BR>21<BR>17<BR>17<BR>16<BR>16<BR>1<BR>25<BR>27<BR>27<BR>38</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>74<BR>74<BR>73<BR>73<BR>68<BR>68<BR><BR>67<BR>1<BR>1<BR>46<BR>47<BR>47<BR>54</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>74<BR>71<BR>71<BR>73<BR>68<BR>66<BR>67<BR>67<BR>46<BR>46<BR>45<BR>47<BR>54</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>75<BR>71<BR>72<BR>72<BR>70<BR>66<BR>66<BR>69<BR>49<BR>45<BR>45<BR>48<BR>51</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>75<BR>75<BR>72<BR>65<BR>70<BR>70<BR>69<BR>69<BR>49<BR><BR>49<BR>48<BR>48<BR>44</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>83<BR>83<BR>82<BR>65<BR>65<BR>77<BR>78<BR>78<BR>62<BR>62<BR>61<BR>44<BR>44</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>83<BR>81<BR>82<BR>82<BR>77<BR>77<BR>76<BR>78<BR>62<BR>60<BR>61<BR>61<BR>56</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>85<BR>81<BR>81<BR>84<BR>80<BR>76<BR>76<BR>79<BR>64<BR>60<BR>60<BR>63<BR>59</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>85<BR>85<BR>84<BR>84<BR>80<BR>80<BR>79<BR>79<BR>64<BR>64<BR>63<BR>63<BR>59</FONT></FONT><BR><FONT face="Times New Roman"><FONT color="#000000"> </FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>Columns 14 through 16 </FONT></FONT><BR><FONT face="Times New Roman"><FONT color="#000000"> </FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>33<BR>31<BR>31</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>29<BR>29<BR>31</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>30<BR>29<BR>32</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>30<BR>32<BR>32</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>35<BR>36<BR>36</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>35<BR>34<BR>36</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>34<BR>34<BR>37</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>38<BR>37<BR>37</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>54<BR>52<BR>52</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>50<BR>50<BR>52</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>51<BR>50<BR>53</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>51<BR>53<BR>53</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>56<BR>57<BR>57</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>56<BR>55<BR>57</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>55<BR>55<BR>58</FONT></FONT><BR><FONT color="#000000"><FONT face="Times New Roman"><BR>59<BR>58<BR>58</FONT></FONT>

zhenenwang 发表于 2012-8-24 22:10

顶顶顶顶顶顶顶
页: [1]
查看完整版本: 200908网友求助《棋盘覆盖问题》