下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、題目來源:POI97 Problem2者:情況:可以通過構(gòu)造法來解決問題。理由:由于題目的數(shù)據(jù)量很大,一看即知不可能用搜索解決,且無法套用任何現(xiàn)成的算法,只能通過巧妙的構(gòu)造來解決,因此為大家留下了很大的發(fā)揮空間,各人可以設(shè)計(jì)出各種不同的構(gòu)造方法,因此希望和大家。JumpsJumps is a board game played on an infinite tof squares. Th has neither left nor right limit. On the squares there is finiy many t thepie(moren onece on a square is
2、 allowed). We amemost left, non-empty square is numbered 0. Squares on the right are denoted by consecutive natural numbers 1, 2, 3, ., squares on the left - by negative numbers: -1, -2, -3, . . The configuration of pie on theboard by piecan be describedhe following way: for every square occupiedeas
3、t onece we give the number of the square and the number ofstanding on this square. There are two kinds of movest canchange the configuration: jump right and jump left. Jump right consistsof removino piefrom th: one from a square p and the other ece on the square p+2. Jump leftfrom the square p+1, an
4、d placing onconsists of removing a piece from a square p+2 and placino pieonth: one on the square p+1 and the other on the square p. We sayt a configuration contains at most on final configuration (jumps).is final if each pair of neighbouring squares ece. For every configuration there is exactly one
5、 t can be reached after finite number of movesTaskWritea programt:reads a description of an initial configuration from the text file SKO.IN,finds the final configurationt can be reached from the given initial configuration andwrites the result to the text file SKO.OUT.Inputheline of the file SKO.her
6、e is oneitiveeger n, 1= n = 10000, which equals the number of non-empty squares of the given initial configuration. In each of the following n lines there is adescription of one non-empty a description consists of two second - the number of piesquare of the initial configuration. Suchegers.is the nu
7、mber of the square,standing on this square. The descriptionsare given in increasing order with respect biggest number of a square is not greaterto numbers of squares. The n 10000 and the number of n 100000000.pieon a single square is not greaterOutputheline of the file SKO.OUT thereshould be written
8、 the finalconfiguration More precisely (in increasingt can be reached from the given initial configuration.the line should contahe numbers of non-empty squaresorder) of the final configuration. The numbers should beseparated by single spa.ExleFor the text file SKO.IN20 53 3the correct solution is th
9、e file SKO.OUT-4 -1 1 3 5POI97Problem2跳躍“跳躍”是一個(gè)棋盤,在一個(gè)無限大的帶狀方格上進(jìn)行。棋盤既沒有左邊界也沒有右邊界。在棋盤上放著有限的棋子(一格上可以有多個(gè)棋子)。假定最左非空的方格被標(biāo)號為 0。右邊的方格被表示成連續(xù)的自然數(shù) 1, 2, 3, .,左邊的方格被表示成負(fù)整數(shù):-1, -2, -3, .。棋盤上棋子的放置方式被描述為以下方式:給出每一個(gè)至少有一個(gè)棋子的方格的標(biāo)號以及方格上棋子的個(gè)數(shù)。有兩種移動(dòng)方式可以改變棋子的放置方式:右跳與左跳。右跳有以下步驟,從棋盤上移走兩個(gè)棋子:一個(gè)從方格p,另一個(gè)從方格p+1,并且在方格p+2 上放上一個(gè)棋子。
10、左跳有以下步驟,從方格p+2 移走一個(gè)棋子,并且在棋盤上放置兩個(gè)棋子:一個(gè)放在方格p+1 上,另一個(gè)放在方格 p 上。一個(gè)最終狀態(tài)定義為:兩個(gè)相鄰方格至多只有一個(gè)棋子。對于每一個(gè)棋盤放置方式可以通過有限步來達(dá)到一種最終狀態(tài),并且只有一種最終狀態(tài)。任務(wù)寫一個(gè)程序:從輸入文件SKO.IN 中讀入棋盤初始狀態(tài)的描述找出所給初始狀態(tài)可以達(dá)到的最終狀態(tài),并且將最終狀態(tài)的描述輸出到輸出文件SKO.OUT。輸入在輸入文件SKO.IN 的第一行有一個(gè)正整數(shù)n,1 = n = 10000,表示非空方格的數(shù)目。在接下來的每一行中有兩個(gè)整數(shù)。第一個(gè)是方格的標(biāo)號,第二個(gè)是方格上棋子數(shù)目。描述以方格標(biāo)號的升序順序給出。其中最大的方
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2026廣東廣州市黃埔區(qū)林業(yè)工作站招聘政府初級雇員2人備考題庫及答案詳解一套
- 廣東省職業(yè)技能等級認(rèn)定證書試卷西式面點(diǎn)師三級高級理論試卷及答案
- 2026中國日報(bào)學(xué)霸課堂公眾號視頻運(yùn)營招聘備考題庫完整答案詳解
- 2026廣東東莞市大灣區(qū)大學(xué)專職心理咨詢師招聘1人備考題庫及一套完整答案詳解
- 2025山東東營市東凱實(shí)驗(yàn)學(xué)校招聘數(shù)學(xué)教師1人備考題庫及參考答案詳解1套
- 2026年上半年昭通學(xué)院招聘碩士研究生工作人員備考題庫(26人)及1套完整答案詳解
- 2026江西省江鹽科技有限公司一批次招聘2人備考題庫及1套參考答案詳解
- 2026山東事業(yè)單位統(tǒng)考濰坊臨朐縣招聘19人備考題庫及參考答案詳解一套
- 2026上半年貴州事業(yè)單位聯(lián)考省委直屬事業(yè)單位招聘4人備考題庫附答案詳解
- 2026山西省中西醫(yī)結(jié)合醫(yī)院招聘博士研究生20人備考題庫及完整答案詳解
- 建筑施工現(xiàn)場材料采購流程
- DB31∕T 1234-2020 城市森林碳匯計(jì)量監(jiān)測技術(shù)規(guī)程
- 園林綠化施工工藝及注意事項(xiàng)
- 2025年高中語文必修上冊《登泰山記》文言文對比閱讀訓(xùn)練(含答案)
- 2025年金蝶AI蒼穹平臺新一代企業(yè)級AI平臺報(bào)告-
- 2026屆山東菏澤一中高三化學(xué)第一學(xué)期期末達(dá)標(biāo)測試試題含解析
- 2025中國機(jī)械工業(yè)集團(tuán)有限公司(國機(jī)集團(tuán))社會(huì)招聘19人筆試參考題庫附答案
- 二年級上冊100以內(nèi)的數(shù)學(xué)加減混合口算題500道-A4直接打印
- 2025年二級造價(jià)師《土建工程實(shí)務(wù)》真題卷(附解析)
- 智慧農(nóng)業(yè)管理中的信息安全對策
- 港口安全生產(chǎn)知識培訓(xùn)課件
評論
0/150
提交評論