
下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、ZOJ2700Andrew Stankevichs Contest #9Quadratic Equation解題報告題目大意對于關于t的0/1系數多項式a(t)、b(t)和c(t),求方程a(t)x2(t)+b(t)x(t)+c(t)=0的一個解x(t)。0/1系數多項式是每項系數都為0或1的多項式,在加減乘時所有系數在mod 2下進行運算。a(t)、b(t)、c(t)的次數都不超過127。算法分析首先可以注意到其次多項式a(t)x2(t)、b(t)x(t)和c(t)必然有兩個次數相等而大于另一個的次數,否則這三個多項式的和不可能是0。分別討論三種情形可以得到x(t)次數的最大值。這樣可以從可
2、能的最高次依次向下確定x(t)的每個系數。每次可以確定形如ax=b的方程,因而有時系數01均可,有時則無解,必須回溯。x(t)確定后需要再驗證是否為方程的解。效率和優(yōu)化由于過程中不能立即確定系數的情形出現不多,程序運行效果非常好。樸素的遞歸式dfs寫法即可AC。此外,整個方程可以化為一個線性方程組,在不考慮重復和無意義方程(即0=0)時方程個數多于未知數個數。運用有關線性方程組的知識可能可以得到更多結論。總結和體會作這道題時有相當長時間的對回溯的畏懼。對于這種充滿了0的方程組,一定的回溯或許是無法避免的。原題Quadratic EquationTime limit: 10 Seconds Me
3、mory limit: 32768K Special JudgeTotal Submit: 33 Accepted Submit: 11 Children in school learn how to solve quadratic equations - that is, equations of form ax2+bx+c=0, where a , b and c are some given real numbers, and x is the real number to find. In this problem you have to solve quadratic equatio
4、n for polynomials with coefficients from Z/2Z . Recall, that there are two numbers in Z/2Z : 0 and 1 , and all operations in this field are performed modulo 2 . Given polynomials a(t) , b(t) and c(t) , find such polynomial x(t) that a(t)x2(t)+b(t)x(t)+c(t)=0, where equality should be considered as p
5、olynomial equality. Remember, that two polynomials are equal if and only if their coefficients at corresponding powers of t are equal. InputThere are mutilple cases in the input file. Each case contains a(t) , b(t) and c(t) , specified as their power followed by their coefficients, starting from the
6、 leading one (the coefficient at the greatest power of t ). Zero polynomial has the degree of -1 for the purpose of this problem. Degrees of all polynomials do not exceed 127 . There is an empty line after each case. OutputIf there is at least one solution to the equation, output any one in the same
7、 format, that is used in input. Leading coefficient of the answer polynomial must not be zero. The degree of the polynomial must not exceed 512. In the other case print “no solution” on the first line of the output file. There should be an empty line after each case. Sample Input0 12 1 1 03 1 0 0 0 0 11 1 10 1-1-1-1Sample Output1 1 0no solution-1In the first example the equation has the form x(t)2+(t2+t)x(t)+t3=0, and x(t) = t is clearly a solution. In the second example the equation is x(t
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 【臨汾】2025年山西臨汾大寧縣面向社會公開招聘幼兒教師13名筆試歷年典型考題及考點剖析附帶答案詳解
- 文庫發(fā)布:稅務課件語
- 美術藝考教學課件
- 磨美發(fā)剪刀教學課件
- 敬愛兄長主題班會課件
- 自制鋼琴教學課件
- 教育讀書匯報課件
- 教育系統(tǒng)形勢與政策課件
- 【恩施】2025年湖北恩施州建始縣自然資源和規(guī)劃局所屬二級單位選聘工作人員10人筆試歷年典型考題及考點剖析附帶答案詳解
- 題型06 實驗中影響因素的探究-備戰(zhàn)2020年中考化學實驗題型特訓(原卷版)
- 2025至2030中國礦用卡車行業(yè)發(fā)展趨勢分析與未來投資戰(zhàn)略咨詢研究報告
- 氟骨癥課件教學課件
- 腳手架知識試題集及答案
- 宣城宣州區(qū)“政聘企培”人才引進筆試真題2024
- 診后疾病管理行業(yè)體系構建
- 成都東方廣益投資有限公司下屬企業(yè)招聘筆試真題2024
- SL631水利水電工程單元工程施工質量驗收標準第1部分:土石方工程
- (正式版)HGT 22820-2024 化工安全儀表系統(tǒng)工程設計規(guī)范
- GB/T 20540.2-2006測量和控制數字數據通信工業(yè)控制系統(tǒng)用現場總線類型3:PROFIBUS規(guī)范第2部分:物理層規(guī)范和服務定義
- GB/T 19411-2003除濕機
- FZ/T 64078-2019熔噴法非織造布
評論
0/150
提交評論