




版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、NKOJ 1039: ArbitrageTime Limit: 1500 ms Memory Limit: 10000 kB Total Submit : 56 (25 users) Accepted Submit : 29 (24 users) Page View : 1456 Font Style: Aa Aa Aa Arbitrage is the use of discrepancies in currency exchange rate
2、s to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar buys 0.5 British pound, 1 British pound buys 10.0 French francs, and 1 French franc buys 0.21 US dollar. Then, by converting currencies, a clever trader can start with 1 US dolla
3、r and buy 0.5 * 10.0 * 0.21 = 1.05 US dollars, making a profit of 5 percent. Your job is to write a program that takes a list of currency exchange rates as input and then determines whether arbitrage is possible or not. InputThe input file will contain one or more test cases. Om the first line of ea
4、ch test case there is an integer n (1<=n<=30), representing the number of different currencies. The next n lines each contain the name of one currency. Within a name no spaces will appear. The next line contains one integer m, representing the length of the table to follow. The last m lines ea
5、ch contain the name ci of a source currency, a real number rij which represents the exchange rate from ci to cj and a name cj of the destination currency. Exchanges which do not appear in the table are impossible.Test cases are separated from each other by a blank line. Input is terminated by a valu
6、e of zero (0) for n.OutputFor each test case, print one line telling whether arbitrage is possible or not in the format "Case case: Yes" respectively "Case case: No".Sample Input3USDollarBritishPoundFrenchFranc3USDollar 0.5 BritishPoundBritishPound 10.0 FrenchFrancFrenchFranc 0.2
7、1 USDollar3USDollarBritishPoundFrenchFranc6USDollar 0.5 BritishPoundUSDollar 4.9 FrenchFrancBritishPound 10.0 FrenchFrancBritishPound 1.99 USDollarFrenchFranc 0.09 BritishPoundFrenchFranc 0.19 USDollar0Sample OutputCase 1: YesCase 2: NoNKOJ1784: Six Degrees of Cowvin BaconTime Limit: 1500 ms &
8、#160; Memory Limit: 65536 kB Judge type: Multi-casesTotal Submit : 28 (15 users) Accepted Submit : 15 (14 users) Page View : 433 Font Style: Aa Aa Aa The cows have been making movies lately, so they are ready to play a variant of the famo
9、us game "Six Degrees of Kevin Bacon". The game works like this: each cow is considered to be zero degrees of separation (degrees) away from herself. If two distinct cows have been in a movie together, each is considered to be one 'degree' away from the other. If a two cows have nev
10、er worked together but have both worked with a third cow, they are considered to be two 'degrees' away from each other (counted as: one degree to the cow they've worked with and one more to the other cow). This scales to the general case. The N (2 <= N <= 300) cows are interested i
11、n figuring out which cow has the smallest average degree of separation from all the other cows. excluding herself of course. The cows have made M (1 <= M <= 10000) movies and it is guaranteed that some relationship path exists between every pair of cows. Input* Line 1: Two space-separated inte
12、gers: N and M * Lines 2.M+1: Each input line contains a set of two or more space-separated integers that describes the cows appearing in a single movie. The first integer is the number of cows participating in the described movie, (e.g., Mi); the subsequent Mi integers tell which cows were. Output*
13、Line 1: A single integer that is 100 times the shortest mean degree of separation of any of the cows. Sample Input4 23 1 2 32 3 4Sample Output100NKOJ 1610: Play on WordsTime Limit: 1500 ms Memory Limit: 10000 kB Total Submit : 99 (23 users) Accepted Sub
14、mit : 23 (17 users) Page View : 763 Font Style: Aa Aa Aa Some of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the puzzle is very important for us. T
15、here is a large number of magnetic plates on every door. Every plate has one word written on it. The plates must be arranged into a sequence in such a way that every word begins with the same letter as the previous word ends. For example, the word acm'' can be followed by the word motorola
16、39;'. Your task is to write a computer program that will read the list of words and determine whether it is possible to arrange all of the plates in a sequence (according to the given rule) and consequently to open the door. InputThe input consists of T test cases. The number of them (T) is give
17、n on the first line of the input file. Each test case begins with a line containing a single integer number Nthat indicates the number of plates (1 <= N <= 100000). Then exactly Nlines follow, each containing a single word. Each word contains at least two and at most 1000 lowercase characters,
18、 that means only letters 'a' through 'z' will appear in the word. The same word may appear several times in the list.OutputYour program has to determine whether it is possible to arrange all the plates in a sequence such that the first letter of each word is equal to the last letter
19、of the previous word. All the plates from the list must be used, each exactly once. The words mentioned several times must be used that number of times. If there exists such an ordering of plates, your program should print the sentence "Ordering is possible.". Otherwise, output the sentenc
20、e "The door cannot be opened.". Sample Input32acmibm3acmmalformmouse2okokSample OutputThe door cannot be opened.Ordering is possible.The door cannot be opened.NKOJ其他圖論基本題目1078、1755、1756、1559POJ圖論基本題目1062、1125、1797、2253、1251、1258、1789、2485ACM競(jìng)賽須掌握的知識(shí)圖論 路
21、徑問(wèn)題 最短路徑 0/1 邊權(quán)最短路徑 BFS
22、0; 非負(fù)邊權(quán)最短路徑 Dijkstra u 可以用Dijkstra解決的問(wèn)題的特征 負(fù)邊權(quán)最短路徑 Bellman-Ford u
23、 Bellman-Ford的Yen-氏優(yōu)化 u 差分約束系統(tǒng) Floyd u 廣義路徑問(wèn)題 u
24、 傳遞閉包 u 極小極大距離 / 極大極小距離 Euler Path / Tour 圈套圈算法 混合圖的 Euler Path / Tour Hamilton Path / Tour 特殊圖的Hamilton Path / Tour 構(gòu)造 生成樹(shù)問(wèn)題
25、60; 最小生成樹(shù) 第k小生成樹(shù) 最優(yōu)比率生成樹(shù) u
26、160; 0/1分?jǐn)?shù)規(guī)劃 度限制生成樹(shù) 連通性問(wèn)題 u 強(qiáng)大的DFS算法 無(wú)向圖連通性 &
27、#160; 割點(diǎn) 割邊 二連通分支 有向圖連通性
28、0; 強(qiáng)連通分支 u 2-SAT u 最小點(diǎn)基 有向無(wú)環(huán)圖 拓?fù)渑判?u 有向無(wú)環(huán)圖與動(dòng)態(tài)規(guī)劃的關(guān)系 二分圖匹配問(wèn)題 u 一般圖問(wèn)題與二分圖問(wèn)題的轉(zhuǎn)換思路 最大匹配
29、u 有向圖的最小路徑覆蓋 u 0 / 1矩陣的最小覆蓋 完備匹配 最優(yōu)匹配 網(wǎng)絡(luò)流問(wèn)題 u 網(wǎng)絡(luò)流模型的簡(jiǎn)單特征和與線(xiàn)性規(guī)劃的關(guān)系 最大流最小割定理
30、 最大流問(wèn)題 有上下界的最大流問(wèn)題 u 循環(huán)流 最小費(fèi)用最大流 / 最大費(fèi)用最大流 弦圖的性質(zhì)和判定 組合數(shù)學(xué) u 解決組合數(shù)學(xué)問(wèn)題時(shí)常用的思想 u 逼近 u 遞推 / 動(dòng)態(tài)規(guī)劃
31、 概率問(wèn)題 Polya 定理 計(jì)算幾何 / 解析幾何 u 計(jì)算幾何的核心:叉積 / 面積 u 解析幾何的主力:復(fù)數(shù) 基本形 點(diǎn) 直線(xiàn),線(xiàn)段
32、0; 多邊形 凸多邊形 / 凸包 u 凸包算法的引進(jìn),卷包裹法 Graham 掃描法 u 水平序的引進(jìn),共線(xiàn)凸包的補(bǔ)丁 完美凸包算法 相關(guān)判定
33、0; 兩直線(xiàn)相交 兩線(xiàn)段相交 點(diǎn)在任意多邊形內(nèi)的判定 點(diǎn)在凸多邊形內(nèi)的判定 &
34、#160; 經(jīng)典問(wèn)題 最小外接圓 近似O(n)的最小外接圓算法 &
35、#160; 點(diǎn)集直徑 旋轉(zhuǎn)卡殼,對(duì)踵點(diǎn) 多邊形的三角剖分 數(shù)學(xué) / 數(shù)論
36、160; 最大公約數(shù) Euclid 算法 擴(kuò)展的Euclid算法 &
37、#160; 同余方程 / 二元一次不定方程
38、160; 同余方程組 線(xiàn)性方程組 高斯消元法 u 解mod 2域上的線(xiàn)性方程組 u 整系數(shù)方程組的精確解法 矩陣 行列式的計(jì)算 u
39、0; 利用矩陣乘法快速計(jì)算遞推關(guān)系 分?jǐn)?shù) 分?jǐn)?shù)樹(shù) 連分?jǐn)?shù)逼近 數(shù)論計(jì)算
40、160; 求N的約數(shù)個(gè)數(shù) 求phi(N) 求約數(shù)和
41、160; 素?cái)?shù)問(wèn)題 概率判素算法 概率因子分解 數(shù)據(jù)結(jié)構(gòu): 組織結(jié)構(gòu) 二叉堆 左偏樹(shù) &
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025-2030中國(guó)傳媒行業(yè)全景調(diào)研與投資戰(zhàn)略研究咨詢(xún)報(bào)告
- 2025-2030中國(guó)代餐輕食市場(chǎng)消費(fèi)渠道調(diào)查及投資潛力分析研究報(bào)告
- 2025-2030中國(guó)親子旅游行業(yè)經(jīng)營(yíng)風(fēng)險(xiǎn)預(yù)警與未來(lái)投資潛力建議研究報(bào)告
- 2025-2030中國(guó)交流弧焊機(jī)行業(yè)發(fā)展分析及發(fā)展趨勢(shì)與投資前景預(yù)測(cè)研究報(bào)告
- 2025-2030中國(guó)互聯(lián)網(wǎng)數(shù)據(jù)中心(IDC)IT行業(yè)研發(fā)創(chuàng)新與應(yīng)用深化發(fā)展分析研究報(bào)告
- 2025-2030中國(guó)乳業(yè)行業(yè)市場(chǎng)現(xiàn)狀供需分析及投資評(píng)估規(guī)劃分析研究報(bào)告
- 2025-2030中國(guó)乘用車(chē)行業(yè)市場(chǎng)發(fā)展分析及競(jìng)爭(zhēng)策略與投資前景研究報(bào)告
- 2025-2030中國(guó)不銹鋼行業(yè)市場(chǎng)發(fā)展分析及發(fā)展趨勢(shì)與投資戰(zhàn)略研究報(bào)告
- 2025-2030中國(guó)萬(wàn)能險(xiǎn)行業(yè)規(guī)模預(yù)測(cè)及未來(lái)投資風(fēng)險(xiǎn)預(yù)警研究報(bào)告
- 產(chǎn)品采購(gòu)及供應(yīng)鏈合作協(xié)議內(nèi)容
- 姜文導(dǎo)演風(fēng)格分析
- 全民國(guó)家安全教育日知識(shí)測(cè)試題庫(kù)和答案
- 醫(yī)療耗材采購(gòu)工作總結(jié)
- 江蘇省蘇州市2023-2024學(xué)年五年級(jí)下學(xué)期期中綜合測(cè)試數(shù)學(xué)試卷(蘇教版)
- 廉潔教育班會(huì).省公開(kāi)課一等獎(jiǎng)全國(guó)示范課微課金獎(jiǎng)?wù)n件
- 汽車(chē)振動(dòng)學(xué):基于MATLABSimulink的分析與實(shí)現(xiàn) 課件 第2章 汽車(chē)單自由度振動(dòng)系統(tǒng)
- 2024版醫(yī)療器械行業(yè)數(shù)字化轉(zhuǎn)型白皮書(shū)
- 12 清貧公開(kāi)課一等獎(jiǎng)創(chuàng)新教案
- 第四講:簡(jiǎn)單長(zhǎng)管的水力計(jì)算
- T-HNMES 11-2023 盾構(gòu)機(jī)選型設(shè)計(jì)生產(chǎn)協(xié)同制造規(guī)范
- 2020-2021學(xué)年復(fù)旦附中高二年級(jí)下冊(cè)英語(yǔ)期中試卷(部分解析版)
評(píng)論
0/150
提交評(píng)論