



下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、題目來源Ural 1590 Bacons Cipher問題描述輸入一個串,輸出它的不同子串的個數(shù)。算法依次統(tǒng)計長度為 1、2、3n 的子串中重復的個數(shù)。算法證明無需證明。算法實現(xiàn)沒有實現(xiàn)上。源代碼const maxn=10000;var a:arraya.zof long;f:array1.maxnof;l1,l2:array1.maxnof longst:ansistring;n,i,j,k,s,ans:longbegin;/ assign(input,input.txt); reset(input);readln(st); for i:=1 to ans:=0;for i:=1 ton:=
2、length(st);n-1 do l1i:=i+1; l1n:=0;n do begins:=0; fillchar(f,sizeof(f),0); fillchar(l2,sizeof(l2),0);for j:=1 to n-i+1f not fj then begink:=j; whileiffillchar(a,sizeof(a),0); (k0)and(k0 then begin l2astk+i-1:=k; inc(s);end;astk+i-1:=k; fk:=true; k:=l1k; end;end;l1:=l2; ans:=ans+n-i+1-s; end;wriend.
3、n(ans);原題描述:1590. Bacons CypherTime Limit: 1.0 second Memory Limit: 64 MBProgrammer Vasya was down on his luck. Instead of a vacation, he was sent to a scientific conference.“It is nesary to increase your competence,” hiss said, “its an important conference on cryptography, and its held in France, w
4、herethey used encryptiondays of Viete.”he days of de Richeu and cracked codesheOne of the talks at the conference was about the attempts to solve Baconscyphers. The speakroed a hypothesist the key to Baconssecrets could be found if allyzed.sible substrings of Bacons works were“But there are too many
5、 of them!” Vasya expressed his astonishment.“Not as many as you think,” the speaker answered, “count them all and youll see it yourself.”t evening Vasya found on the Web the complete set of Bacons works.He wrote a programt converted the textso one long string byremoving all linebreaks, spa, and punc
6、tuation marks. And now Vasya isconfused because he doesnt know how to calculate the number of different substrings of this string.InputYou are given a nonempty string consisting of lowercase English letters.The string is no longern 5000 symbols.OutputOutput the number of different substrings of this string.SleinputoutputProblem Author: Alex Ge
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 貫徹落實老年教育發(fā)展規(guī)劃2012020年工作推進會暨全國示范
- 向物業(yè)申請修改物業(yè)費申請書(6篇)
- 2025財務部門年度工作計劃
- 2025年專門用途燈具:工藝裝飾燈具項目發(fā)展計劃
- 教育國際化背景下的文化沖突與融合問題研究
- 教育技術與職業(yè)發(fā)展趨勢與挑戰(zhàn)并存
- 云南楚雄州南華縣民中2025年物理高二第二學期期末監(jiān)測試題含解析
- 2025年路面清潔裝備項目合作計劃書
- 2025年山東省即墨區(qū)重點高中物理高一第二學期期末復習檢測模擬試題含解析
- 如何利用活動營銷增強教育培訓品牌形象
- 凈水設備維保合同
- 績效考核量化指標
- 三國演義章回目錄范文
- 2025年結核病防治知識競賽題庫及答案(共117題)
- 鍋爐水處理作業(yè)人員(特種作業(yè))考試歷年真題及答案
- UL499標準中文版-2017電加熱裝置UL中文版標準
- 中華人民共和國安全生產法培訓課件
- 代加工合作合同書范例
- 數(shù)據(jù)安全管理員(技師)職業(yè)技能鑒定考試題庫-下(填空、實操題)
- 2024年同等學力申碩英語考試真題
- 瀝青拌合站安裝專項施工方案
評論
0/150
提交評論