數(shù)字運算,判斷一個數(shù)是否接近素數(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
上傳時間: 2015-05-21
上傳用戶:daguda
電力系統(tǒng)在臺穩(wěn)定計算式電力系統(tǒng)不正常運行方式的一種計算。它的任務是已知電力系統(tǒng)某一正常運行狀態(tài)和受到某種擾動,計算電力系統(tǒng)所有發(fā)電機能否同步運行 1運行說明: 請輸入初始功率S0,形如a+bi 請輸入無限大系統(tǒng)母線電壓V0 請輸入系統(tǒng)等值電抗矩陣B 矩陣B有以下元素組成的行矩陣 1正常運行時的系統(tǒng)直軸等值電抗Xd 2故障運行時的系統(tǒng)直軸等值電抗X d 3故障切除后的系統(tǒng)直軸等值電抗 請輸入慣性時間常數(shù)Tj 請輸入時段數(shù)N 請輸入哪個時段發(fā)生故障Ni 請輸入每時段間隔的時間dt
標簽: 電力系統(tǒng) 正 計算 運行
上傳時間: 2015-06-13
上傳用戶:it男一枚
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
一:需求分析 1. 問題描述 魔王總是使用自己的一種非常精練而抽象的語言講話,沒人能聽懂,但他的語言是可逐步解釋成人能聽懂的語言,因為他的語言是由以下兩種形式的規(guī)則由人的語言逐步抽象上去的: ----------------------------------------------------------- (1) a---> (B1)(B2)....(Bm) (2)[(op1)(p2)...(pn)]---->[o(pn)][o(p(n-1))].....[o(p1)o] ----------------------------------------------------------- 在這兩種形式中,從左到右均表示解釋.試寫一個魔王語言的解釋系統(tǒng),把 他的話解釋成人能聽得懂的話. 2. 基本要求: 用下述兩條具體規(guī)則和上述規(guī)則形式(2)實現(xiàn).設大寫字母表示魔王語言的詞匯 小寫字母表示人的語言的詞匯 希臘字母表示可以用大寫字母或小寫字母代換的變量.魔王語言可含人的詞匯. (1) B --> tAdA (2) A --> sae 3. 測試數(shù)據(jù): B(ehnxgz)B 解釋成 tsaedsaeezegexenehetsaedsae若將小寫字母與漢字建立下表所示的對應關系,則魔王說的話是:"天上一只鵝地上一只鵝鵝追鵝趕鵝下鵝蛋鵝恨鵝天上一只鵝地上一只鵝". | t | d | s | a | e | z | g | x | n | h | | 天 | 地 | 上 | 一只| 鵝 | 追 | 趕 | 下 | 蛋 | 恨 |
上傳時間: 2014-12-02
上傳用戶:jkhjkh1982
數(shù)據(jù)結構 1、算法思路: 哈夫曼樹算法:a)根據(jù)給定的n個權值{W1,W2… ,Wn }構成 n棵二叉樹的集合F={T1,T2…,T n },其中每棵二叉樹T中只有一個帶權為W i的根結點,其左右子樹均空;b)在F中選取兩棵根結點的權值最小的樹作為左右子樹構造一棵新的二叉樹,且置新的二叉樹的根結點的權值為其左、右子樹上結點的權值之和;c)F中刪除這兩棵樹,同時將新得到的二叉樹加入F中; d)重復b)和c),直到F只含一棵樹為止。
標簽: 算法 W1 數(shù)據(jù)結構 樹
上傳時間: 2016-03-05
上傳用戶:lacsx
It has been suggested1 that an appropriate figure of merit for a low probability of intercept and detection (LPI/D) waveform is the quantity “Range x Bandwidth / Joule”. That is, the further the range, the wider the bandwidth and the less amount of energy used to achieve these values, the more covert is the resultant communications system.
標簽: appropriate probability suggested1 intercept
上傳時間: 2017-01-03
上傳用戶:kr770906
將魔王的語言抽象為人類的語言:魔王語言由以下兩種規(guī)則由人的語言逐步抽象上去的:α-〉β1β2β3…βm ;θδ1δ2…-〉θδnθδn-1…θδ1 設大寫字母表示魔王的語言,小寫字母表示人的語言B-〉tAdA,A-〉sae,eg:B(ehnxgz)B解釋為tsaedsaeezegexenehetsaedsae對應的話是:“天上一只鵝地上一只鵝鵝追鵝趕鵝下鵝蛋鵝恨鵝天上一只鵝地上一只鵝”。(t-天d-地s-上a-一只e-鵝z-追g-趕x-下n-蛋h-恨)
上傳時間: 2013-12-19
上傳用戶:aix008
【問題描述】 在一個N*N的點陣中,如N=4,你現(xiàn)在站在(1,1),出口在(4,4)。你可以通過上、下、左、右四種移動方法,在迷宮內(nèi)行走,但是同一個位置不可以訪問兩次,亦不可以越界。表格最上面的一行加黑數(shù)字A[1..4]分別表示迷宮第I列中需要訪問并僅可以訪問的格子數(shù)。右邊一行加下劃線數(shù)字B[1..4]則表示迷宮第I行需要訪問并僅可以訪問的格子數(shù)。如圖中帶括號紅色數(shù)字就是一條符合條件的路線。 給定N,A[1..N] B[1..N]。輸出一條符合條件的路線,若無解,輸出NO ANSWER。(使用U,D,L,R分別表示上、下、左、右。) 2 2 1 2 (4,4) 1 (2,3) (3,3) (4,3) 3 (1,2) (2,2) 2 (1,1) 1 【輸入格式】 第一行是數(shù)m (n < 6 )。第二行有n個數(shù),表示a[1]..a[n]。第三行有n個數(shù),表示b[1]..b[n]。 【輸出格式】 僅有一行。若有解則輸出一條可行路線,否則輸出“NO ANSWER”。
標簽: 點陣
上傳時間: 2014-06-21
上傳用戶:llandlu
第一節(jié)、samba是干什么的?它有什么用? Samba(SMB是其縮寫) 是一個網(wǎng)絡服務器,它是Linux作為本地服務器最重要的一個服務,用于Linux和Windows共享文件之用;Samba可以用于Windows和 Linux之間的共享文件,也一樣用于Linux和Linux之間的共享文件;不過對于Linux和Linux之間共享文件有更好的網(wǎng)絡文件系統(tǒng) NFS,NFS也是需要架設服務器的; 2、安裝及服務操作命令 安裝samba程序非常簡單,使用rpm -q samba查看當前系統(tǒng)是否已經(jīng)安裝了samba軟件。 如果沒有那就進入光盤,rpm -ivh *samba*.rpm即可。 仔細說下安裝的包: samba-common-3.0.28-0.el5.8 //samba服務器和客戶端中的最基本文件 samba-3.0.28-0.el5.8 //samba服務器核心軟件包 system-config-samba-1.2.39-1.el5 //samba圖形配置界面 samba-client-3.0.28-0.el5.8 //samba客戶端軟件 啟動、暫停和停止服務: /etc/init.d/smb start /etc/init.d/smb stop /etc/init.d/smb restart 或 service smb start service smb stop service smb restart 第二節(jié)、由最簡單的一個例子說起,匿名用戶可讀可寫的實現(xiàn) 第一步: 更改smb.conf 我們來實現(xiàn)一個最簡單的功能,讓所有用戶可以讀寫一個Samba 服務器共享的一個文件夾;我們要改動一下smb.conf ;首先您要備份一下smb.conf文件; [root@localhost ~]# cd /etc/samba [root@localhost samba]# cp smb.conf smb.conf.bak [root@localhost samba]# vi smb.conf 或geidt smb.conf & 然后我們把下面這段寫入smb.conf中: [global] workgroup = WORKGROUP netbios name = Liukai server string = Liukai's Samba Server security = share [test] path = /opt/test writeable = yes browseable = yes guest ok = yes 注解: [global]這段是全局配置,是必段寫的。其中有如下的幾行; workgroup 就是Windows中顯示的工作組;在這里我設置的是WORKGROUP (用大寫); netbios name 就是在Windows中顯示出來的計算機名; server string 就是Samba服務器說明,可以自己來定義;這個不是什么重要的; security 這是驗證和登錄方式,這里我們用了share ;驗證方式有好多種,這是其中一種;另外一種常用的是user的驗證方式;如果用share呢,就是不用設置用戶和密碼了; [test] 這個在Windows中顯示出來是共享的目錄; path = 可以設置要共享的目錄放在哪里; writeable 是否可寫,這里我設置為可寫; browseable 是否可以瀏覽,可以;可以瀏覽意味著,我們在工作組下能看到共享文件夾。如果您不想顯示出來,那就設置為 browseable=no,guest ok 匿名用戶以guest身份是登錄; 第二步:建立相應目錄并授權 [root@localhost ~]# mkdir -p /opt/test [root@localhost ~]# id nobody uid=99(nobody) gid=99(nobody) groups=99(nobody) [root@localhost ~]# chown -R nobody:nobody /opt/test 注釋:關于授權nobody,我們先用id命令查看了nobody用戶的信息,發(fā)現(xiàn)他的用戶組也是nobody,我們要以這個為準。有些系統(tǒng)nobody用戶組并非是nobody ; 第三步:啟動服務器 第四步:訪問Samba 服務器的共享; 1、在Linux 中您可以用下面的命令來訪問; [root@localhost ~]# smbclient -L //liukai或 smbclient //192.168.0.94/test Password: 注:直接按回車 2、在Windows中,您可以用下面的辦法來訪問; \\liukai 或 \\192.168.0.94 3、說明:如果用了netbiosname,就可以用“\\主機名”來訪問,如果沒用netbiosname,就不能用主機名訪問。 第三節(jié)、簡單的密碼驗證服務器 修改smb.conf文件: security = user guest account = liukai encrypt passwords = yes smb passwd file = /etc/samba/smbpasswd 然后,建立一個新用戶 useradd liukai passwd liukai 成功后,cat /etc/passwd | mksmbpasswd.sh > /etc/samba/smbpasswd smbpasswd -a liukai 這就成功地添加了一個smb用戶。 重啟服務,使用這個用戶進行登錄即可。
上傳時間: 2015-05-13
上傳用戶:yangkang1192
Use the fast Fourier transform function fft to analyse following signal. Plot the original signal, and the magnitude of its spectrum linearly and logarithmically. Apply Hamming window to reduce the leakage. . The hamming window can be coded in Matlab as for n=1:N hamming(n)=0.54+0.46*cos((2*n-N+1)*pi/N); end; where N is the data length in the FFT.
標簽: matlab fft
上傳時間: 2015-11-23
上傳用戶:石灰?guī)r123