prolog 找路例子程序: === === === === === === Part 1-Adding connections Part 2-Simple Path example | ?- path1(a,b,P,T). will produce the response: T = 15 P = [a,b] ? Part 3 - Non-repeating path As an example, the query: ?- path2(a,h,P,T). will succeed and may produce the bindings: P = [a,depot,b,d,e,f,h] T = 155 Part 4 - Generating a path below a cost threshold As an example, the query: ?- path_below_cost(a,[a,b,c,d,e,f,g,h],RS,300). returns: RS = [a,b,depot,c,d,e,g,f,h] ? RS = [a,c,depot,b,d,e,g,f,h] ? no ==================================
標(biāo)簽: Part connections example prolog
上傳時(shí)間: 2015-04-24
上傳用戶(hù):ljt101007
數(shù)字運(yùn)算,判斷一個(gè)數(shù)是否接近素?cái)?shù) A Niven number is a number such that the sum of its digits divides itself. For example, 111 is a Niven number because the sum of its digits is 3, which divides 111. We can also specify a number in another base b, and a number in base b is a Niven number if the sum of its digits divides its value. Given b (2 <= b <= 10) and a number in base b, determine whether it is a Niven number or not. Input Each line of input contains the base b, followed by a string of digits representing a positive integer in that base. There are no leading zeroes. The input is terminated by a line consisting of 0 alone. Output For each case, print "yes" on a line if the given number is a Niven number, and "no" otherwise. Sample Input 10 111 2 110 10 123 6 1000 8 2314 0 Sample Output yes yes no yes no
上傳時(shí)間: 2015-05-21
上傳用戶(hù):daguda
Implemented BFS, DFS and A* To compile this project, use the following command: g++ -o search main.cpp Then you can run it: ./search The input is loaded from a input file in.txt Here is the format of the input file: The first line of the input file shoud contain two chars indicate the source and destination city for breadth first and depth first algorithm. The second line of input file shoud be an integer m indicate the number of connections for the map. Following m lines describe the map, each line represents to one connection in this form: dist city1 city2, which means there is a connection between city1 and city2 with the distance dist. The following input are for A* The following line contains two chars indicate the source and destination city for A* algorithm. Then there is an integer h indicate the number of heuristic. The following h lines is in the form: city dist which means the straight-line distance from the city to B is dist.
標(biāo)簽: Implemented following compile command
上傳時(shí)間: 2014-01-01
上傳用戶(hù):lhc9102
LCD-7279的經(jīng)過(guò)調(diào)試多次已經(jīng)能夠?qū)崿F(xiàn)在指定的位置顯示特定的數(shù)據(jù)。 程序lcd1.c實(shí)現(xiàn)基本的功能,即:鍵盤(pán)輸入0、1、2、3、4、5、6、7、8、9、a\b\c\d\e\f 在液晶的指定位置顯示實(shí)現(xiàn)滿(mǎn)屏或半屏顯示點(diǎn)陣和字符,調(diào)入一幅圖畫(huà)的代碼進(jìn)行顯示;
標(biāo)簽: 7279 LCD lcd 調(diào)試
上傳時(shí)間: 2014-01-14
上傳用戶(hù):hgy9473
一:需求分析 1. 問(wèn)題描述 魔王總是使用自己的一種非常精練而抽象的語(yǔ)言講話(huà),沒(méi)人能聽(tīng)懂,但他的語(yǔ)言是可逐步解釋成人能聽(tīng)懂的語(yǔ)言,因?yàn)樗恼Z(yǔ)言是由以下兩種形式的規(guī)則由人的語(yǔ)言逐步抽象上去的: ----------------------------------------------------------- (1) a---> (B1)(B2)....(Bm) (2)[(op1)(p2)...(pn)]---->[o(pn)][o(p(n-1))].....[o(p1)o] ----------------------------------------------------------- 在這兩種形式中,從左到右均表示解釋.試寫(xiě)一個(gè)魔王語(yǔ)言的解釋系統(tǒng),把 他的話(huà)解釋成人能聽(tīng)得懂的話(huà). 2. 基本要求: 用下述兩條具體規(guī)則和上述規(guī)則形式(2)實(shí)現(xiàn).設(shè)大寫(xiě)字母表示魔王語(yǔ)言的詞匯 小寫(xiě)字母表示人的語(yǔ)言的詞匯 希臘字母表示可以用大寫(xiě)字母或小寫(xiě)字母代換的變量.魔王語(yǔ)言可含人的詞匯. (1) B --> tAdA (2) A --> sae 3. 測(cè)試數(shù)據(jù): B(ehnxgz)B 解釋成 tsaedsaeezegexenehetsaedsae若將小寫(xiě)字母與漢字建立下表所示的對(duì)應(yīng)關(guān)系,則魔王說(shuō)的話(huà)是:"天上一只鵝地上一只鵝鵝追鵝趕鵝下鵝蛋鵝恨鵝天上一只鵝地上一只鵝". | t | d | s | a | e | z | g | x | n | h | | 天 | 地 | 上 | 一只| 鵝 | 追 | 趕 | 下 | 蛋 | 恨 |
上傳時(shí)間: 2014-12-02
上傳用戶(hù):jkhjkh1982
The XML Toolbox converts MATLAB data types (such as double, char, struct, complex, sparse, logical) of any level of nesting to XML format and vice versa. For example, >> project.name = MyProject >> project.id = 1234 >> project.param.a = 3.1415 >> project.param.b = 42 becomes with str=xml_format(project, off ) "<project> <name>MyProject</name> <id>1234</id> <param> <a>3.1415</a> <b>42</b> </param> </project>" On the other hand, if an XML string XStr is given, this can be converted easily to a MATLAB data type or structure V with the command V=xml_parse(XStr).
標(biāo)簽: converts Toolbox complex logical
上傳時(shí)間: 2016-02-12
上傳用戶(hù):a673761058
一個(gè)能夠分析三種整數(shù)、標(biāo)識(shí)符、主要運(yùn)算符和主要關(guān)鍵字的詞法分析程序。 ㈠、基本要求: 標(biāo)識(shí)符 <字母>(<字母>|<數(shù)字字符>)* 十進(jìn)制整數(shù) 0 | (1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)* 八進(jìn)制整數(shù) 0(1|2|3|4|5|6|7)(0|1|2|3|4|5|6|7)* 十六進(jìn)制整數(shù) 0x(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f)(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f)* 運(yùn)算符和分隔符 + - * / > < = ( ) ; 關(guān)鍵字 if then else while do ㈡、附加要求: 標(biāo)識(shí)符 <字母>(<字母>|<數(shù)字字符>)*(ε|_|.)(<字母>|<數(shù)字字符>)* 十進(jìn)制整數(shù) (0|1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)*(ε|.)(0|1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)* 八進(jìn)制整數(shù) 0(1|2|3|4|5|6|7)(0|1|2|3|4|5|6|7)* (ε|.)(0|1|2|3|4|5|6|7)(0|1|2|3|4|5|6|7)* 十六進(jìn)制整數(shù) 0x(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f)(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f)* (ε|.) (0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f)(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f)*
上傳時(shí)間: 2016-03-03
上傳用戶(hù):zhengjian
圖的深度遍歷,輸出結(jié)果為(紅色為鍵盤(pán)輸入的數(shù)據(jù),權(quán)值都置為1): 輸入頂點(diǎn)數(shù)和弧數(shù):8 9 輸入8個(gè)頂點(diǎn). 輸入頂點(diǎn)0:a 輸入頂點(diǎn)1:b 輸入頂點(diǎn)2:c 輸入頂點(diǎn)3:d 輸入頂點(diǎn)4:e 輸入頂點(diǎn)5:f 輸入頂點(diǎn)6:g 輸入頂點(diǎn)7:h 輸入9條弧. 輸入弧0:a b 1 輸入弧1:b d 1 輸入弧2:b e 1 輸入弧3:d h 1 輸入弧4:e h 1 輸入弧5:a c 1 輸入弧6:c f 1 輸入弧7:c g 1 輸入弧8:f g 1 深度優(yōu)先遍歷: a b d h e c f g 程序結(jié)束.
標(biāo)簽:
上傳時(shí)間: 2016-04-04
上傳用戶(hù):lht618
基于J2EE的物流信息系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn) 介紹了J2EE 體系結(jié)構(gòu)、Mv c模式等相關(guān)概念和技術(shù),并重點(diǎn)探討了 目 前比 較受歡迎的三種開(kāi)源框架( s t r ut s框架、S Pr i n g框架和H i b e m a t e 框架)。 分析了他們的體系結(jié)構(gòu)、 特點(diǎn)和優(yōu)缺點(diǎn)。 根據(jù)J ZE E的分層結(jié)構(gòu),結(jié)合We b應(yīng)用 的特點(diǎn), 將三種框架進(jìn)行組合設(shè)計(jì), 即表現(xiàn)層用S t r ut s框架、 業(yè)務(wù)邏輯層用S P ri n g 框架、持久層用比b ema t e 框架,從而來(lái)構(gòu)建物流信息系統(tǒng)。這種整合框架使各 層相對(duì)獨(dú)立, 減少各層之間的禍合程度,同時(shí)加快了系統(tǒng)的開(kāi)發(fā)過(guò)程,增強(qiáng)了系 統(tǒng)的可維護(hù)性和可擴(kuò)展性,初步達(dá)到了分布式物流信息系統(tǒng)的設(shè)計(jì)目標(biāo)。 經(jīng)過(guò)以上分析,結(jié)合物流系統(tǒng)的業(yè)務(wù)需求,進(jìn)行了相關(guān)的實(shí)現(xiàn)。最后,系統(tǒng) 運(yùn)用先進(jìn)的A ja x技術(shù)來(lái)增強(qiáng)Ui層與服務(wù)器的異步通信能力, 使用戶(hù)體驗(yàn)到動(dòng)態(tài) 且響應(yīng)靈 敏的桌 面級(jí)w e b應(yīng)用程序。 通過(guò)江聯(lián)公司的試運(yùn)行結(jié)果,系統(tǒng)達(dá)到了 渝瞇。 并 且 對(duì) 江 聯(lián) 公 司 提 出 了 基 于 R F I D 的 解 決 方 案 的 實(shí) 施 計(jì) 劃 。
上傳時(shí)間: 2016-06-01
上傳用戶(hù):ynsnjs
對(duì)于給定的一組進(jìn)程,采用優(yōu)先級(jí)加時(shí)間片輪轉(zhuǎn)法進(jìn)行調(diào)度。設(shè)有一個(gè)就緒隊(duì)列,就緒進(jìn)程按優(yōu)先數(shù)(優(yōu)先數(shù)范圍0-100)由小到大排列(優(yōu)先數(shù)越小,級(jí)別越高)。當(dāng)某一進(jìn)程運(yùn)行完一個(gè)時(shí)間片后,其優(yōu)先級(jí)應(yīng)下調(diào)(如優(yōu)先數(shù)加3),試對(duì)如下給定的一組進(jìn)程給出其調(diào)度順序。每當(dāng)結(jié)束一進(jìn)程時(shí)要給出當(dāng)前系統(tǒng)的狀態(tài)(即顯示就緒隊(duì)列)。這里,進(jìn)程可用進(jìn)程控制塊(PCB)表示為如右表所示。 進(jìn)程名 A B C D E F G H J K L M 到達(dá)時(shí)間 0 1 2 3 6 8 12 12 12 18 25 25 服務(wù)時(shí)間 6 4 10 5 1 2 5 10 4 3 15 8
標(biāo)簽: 進(jìn)程
上傳時(shí)間: 2014-01-13
上傳用戶(hù):chfanjiang
蟲(chóng)蟲(chóng)下載站版權(quán)所有 京ICP備2021023401號(hào)-1