付費(fèi)下載
下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、題目來源:Taejon Regional Contest 2001者:情況: 我只會(huì)搜索,而且極限數(shù)據(jù)還很慢理由:想知道有沒有多項(xiàng)式做法。例如圖論方法,有幾種方法建立模型,但是這些模型都無法解決(有的模型還叫不出名字)。如果是搜索,希望找到一個(gè)對(duì)于極限數(shù)據(jù)也比較快的方法。另外,如果用圖論做的話,或性。以利用本題中圖的特殊Square DestroyerThe left figure below shows a complete 3*3 grid made with 24 matchsticks. The lengths of allmatchsticks are one. You can fi
2、nd many squares of different sizeshe grid. The size of asquare is the length of ite.he grid shownhe left figure, there are 9 squares of sizeone, 4 squares of size two, and 1 square of size three.Eaatchstick of the complete grid is identified wiunique number which is assignedfrom left to right and fr
3、om top to bottom as shown in the left figure. If you take someatchsticks out from the complete grid, then some squareshe grid will be destroyed, whichresults in anplete 3*3 grid. The right figure illustrates anplete 3*3 grid afterremoving three matchsticks numbered with 12, 17 and 23. This removal d
4、estroys 5 squares ofsize one, 3 squares of size two, and 1 square of size three. Consequently, theplete griddoes notwo.ve squares of size three, but still has 4 squares of size one and 1 square of sizeplete) n*n grid made with no moren 2n(n+1)As input, you are given a (complete ormatchsticks for a n
5、atural number n5 .Your task is to compute the minimum number ofmatchsticks taken out to destroy all the squares existinghe input n*n grid.InputThe inponsists ofT test cases. The number of test cases (T ) is givenheline ofthe input file. Each test case consists of two lines: Theline contains a natura
6、l number n ,not greatern 5, which imps you are given a (complete orplete) n*n grid as input,nonnegativeeger k , the number of matchsticksand the second line begins wit aremissing from the complete n*n grid, followed by k numbers specifying the matchsticks. Note t if k is equal to zero, then the inpu
7、t grid is a complete n*n grid; otherwise, the input gridplete n*n grid sucht the specified k matchsticks are missing from the completeis ann*n grid.OutputPrexactly one line for each test case. The line should contain the minimum number ofmatchsticksve to be taken out to destroy all the squareshe inp
8、ut grid.S2203le Input3 12 17 23Output for the S33le Input破壞正方形下邊的圖(a)是一個(gè)用 2*(3*4)=24 根長度為 1長度的火柴棍拼成的完整的 3*3 方格陣。可以看出方格陣中存在許多不同規(guī)模的正方形(正方形的規(guī)模是指其邊的長度)??梢钥闯鲈趫D(a)中的方格陣?yán)?,?9 個(gè)規(guī)模 1 的正方形,4 個(gè)規(guī)模 2 的正方形和 1 個(gè)規(guī)模 3 的正方形。(a)(b)如圖(a)所示,完整的方格陣中的每根火柴棍都可以用一個(gè)唯一的來區(qū)分,從上到下從左往右逐漸增加。如果你從完整的方格陣中拿出一些火柴棍,這個(gè)方格陣中的一些正方形將被破壞,你將得到一個(gè)不完全的 3*3 方格陣。圖(b)是一個(gè)去掉了分別為 12、17和 23 的 3 火柴棍之后剩下的不完全的 3*3 方格陣。去掉這些火柴棍破壞了 5 個(gè)規(guī)模 1 的正方形,3 個(gè)規(guī)模 2 的正方形和 1 個(gè)規(guī)模 3 的正方形。從而,剩下的不完全方格陣沒有了規(guī)模
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 項(xiàng)目管理流程圖解析
- 超支預(yù)警機(jī)制制度
- 診療服務(wù)制度
- 2025年樂理八級(jí)試卷筆試及答案
- 2025年天星教育集團(tuán)編輯筆試及答案
- 2025年濟(jì)南稅務(wù)局筆試真題及答案
- 2025年??途W(wǎng)網(wǎng)易運(yùn)營筆試及答案
- 2025年考云巖區(qū)事業(yè)單位考試題及答案
- 2025年教師編棗莊市筆試及答案
- 2025年-江北區(qū)點(diǎn)招筆試及答案
- 塔吊安裝安全培訓(xùn)教育課件
- 民事答辯狀(信用卡糾紛)樣式
- 人教版七年級(jí)英語下冊(cè)單詞默寫單
- 設(shè)備安裝施工應(yīng)急預(yù)案
- 拼多多會(huì)計(jì)課件
- 卡西歐手表WVA-M600(5161)中文使用說明書
- 電力高處作業(yè)培訓(xùn)
- 人臉門禁系統(tǒng)管理制度
- 辦公設(shè)備清單表格
- 環(huán)保隱患分級(jí)管理制度
- 《鐵路運(yùn)輸調(diào)度》課件全套 孫建暉 第1-5章 貨物列車編組計(jì)劃- 調(diào)度工作分析
評(píng)論
0/150
提交評(píng)論