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 ==================================
標簽: Part connections example prolog
上傳時間: 2015-04-24
上傳用戶:ljt101007
數字運算,判斷一個數是否接近素數 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
上傳時間: 2015-05-21
上傳用戶: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.
標簽: Implemented following compile command
上傳時間: 2014-01-01
上傳用戶:lhc9102
LCD-7279的經過調試多次已經能夠實現在指定的位置顯示特定的數據。 程序lcd1.c實現基本的功能,即:鍵盤輸入0、1、2、3、4、5、6、7、8、9、a\b\c\d\e\f 在液晶的指定位置顯示實現滿屏或半屏顯示點陣和字符,調入一幅圖畫的代碼進行顯示;
上傳時間: 2014-01-14
上傳用戶:hgy9473
一:需求分析 1. 問題描述 魔王總是使用自己的一種非常精練而抽象的語言講話,沒人能聽懂,但他的語言是可逐步解釋成人能聽懂的語言,因為他的語言是由以下兩種形式的規則由人的語言逐步抽象上去的: ----------------------------------------------------------- (1) a---> (B1)(B2)....(Bm) (2)[(op1)(p2)...(pn)]---->[o(pn)][o(p(n-1))].....[o(p1)o] ----------------------------------------------------------- 在這兩種形式中,從左到右均表示解釋.試寫一個魔王語言的解釋系統,把 他的話解釋成人能聽得懂的話. 2. 基本要求: 用下述兩條具體規則和上述規則形式(2)實現.設大寫字母表示魔王語言的詞匯 小寫字母表示人的語言的詞匯 希臘字母表示可以用大寫字母或小寫字母代換的變量.魔王語言可含人的詞匯. (1) B --> tAdA (2) A --> sae 3. 測試數據: B(ehnxgz)B 解釋成 tsaedsaeezegexenehetsaedsae若將小寫字母與漢字建立下表所示的對應關系,則魔王說的話是:"天上一只鵝地上一只鵝鵝追鵝趕鵝下鵝蛋鵝恨鵝天上一只鵝地上一只鵝". | t | d | s | a | e | z | g | x | n | h | | 天 | 地 | 上 | 一只| 鵝 | 追 | 趕 | 下 | 蛋 | 恨 |
上傳時間: 2014-12-02
上傳用戶: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).
標簽: converts Toolbox complex logical
上傳時間: 2016-02-12
上傳用戶:a673761058
一個能夠分析三種整數、標識符、主要運算符和主要關鍵字的詞法分析程序。 ㈠、基本要求: 標識符 <字母>(<字母>|<數字字符>)* 十進制整數 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)(0|1|2|3|4|5|6|7)* 十六進制整數 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)* 運算符和分隔符 + - * / > < = ( ) ; 關鍵字 if then else while do ㈡、附加要求: 標識符 <字母>(<字母>|<數字字符>)*(ε|_|.)(<字母>|<數字字符>)* 十進制整數 (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)* 八進制整數 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)* 十六進制整數 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)*
上傳時間: 2016-03-03
上傳用戶:zhengjian
圖的深度遍歷,輸出結果為(紅色為鍵盤輸入的數據,權值都置為1): 輸入頂點數和弧數:8 9 輸入8個頂點. 輸入頂點0:a 輸入頂點1:b 輸入頂點2:c 輸入頂點3:d 輸入頂點4:e 輸入頂點5:f 輸入頂點6:g 輸入頂點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 深度優先遍歷: a b d h e c f g 程序結束.
標簽:
上傳時間: 2016-04-04
上傳用戶:lht618
基于J2EE的物流信息系統的設計與實現 介紹了J2EE 體系結構、Mv c模式等相關概念和技術,并重點探討了 目 前比 較受歡迎的三種開源框架( s t r ut s框架、S Pr i n g框架和H i b e m a t e 框架)。 分析了他們的體系結構、 特點和優缺點。 根據J ZE E的分層結構,結合We b應用 的特點, 將三種框架進行組合設計, 即表現層用S t r ut s框架、 業務邏輯層用S P ri n g 框架、持久層用比b ema t e 框架,從而來構建物流信息系統。這種整合框架使各 層相對獨立, 減少各層之間的禍合程度,同時加快了系統的開發過程,增強了系 統的可維護性和可擴展性,初步達到了分布式物流信息系統的設計目標。 經過以上分析,結合物流系統的業務需求,進行了相關的實現。最后,系統 運用先進的A ja x技術來增強Ui層與服務器的異步通信能力, 使用戶體驗到動態 且響應靈 敏的桌 面級w e b應用程序。 通過江聯公司的試運行結果,系統達到了 渝瞇。 并 且 對 江 聯 公 司 提 出 了 基 于 R F I D 的 解 決 方 案 的 實 施 計 劃 。
上傳時間: 2016-06-01
上傳用戶:ynsnjs
對于給定的一組進程,采用優先級加時間片輪轉法進行調度。設有一個就緒隊列,就緒進程按優先數(優先數范圍0-100)由小到大排列(優先數越小,級別越高)。當某一進程運行完一個時間片后,其優先級應下調(如優先數加3),試對如下給定的一組進程給出其調度順序。每當結束一進程時要給出當前系統的狀態(即顯示就緒隊列)。這里,進程可用進程控制塊(PCB)表示為如右表所示。 進程名 A B C D E F G H J K L M 到達時間 0 1 2 3 6 8 12 12 12 18 25 25 服務時間 6 4 10 5 1 2 5 10 4 3 15 8
標簽: 進程
上傳時間: 2014-01-13
上傳用戶:chfanjiang