數(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
上傳用戶:daguda
電力系統(tǒng)在臺(tái)穩(wěn)定計(jì)算式電力系統(tǒng)不正常運(yùn)行方式的一種計(jì)算。它的任務(wù)是已知電力系統(tǒng)某一正常運(yùn)行狀態(tài)和受到某種擾動(dòng),計(jì)算電力系統(tǒng)所有發(fā)電機(jī)能否同步運(yùn)行 1運(yùn)行說(shuō)明: 請(qǐng)輸入初始功率S0,形如a+bi 請(qǐng)輸入無(wú)限大系統(tǒng)母線電壓V0 請(qǐng)輸入系統(tǒng)等值電抗矩陣B 矩陣B有以下元素組成的行矩陣 1正常運(yùn)行時(shí)的系統(tǒng)直軸等值電抗Xd 2故障運(yùn)行時(shí)的系統(tǒng)直軸等值電抗X d 3故障切除后的系統(tǒng)直軸等值電抗 請(qǐng)輸入慣性時(shí)間常數(shù)Tj 請(qǐng)輸入時(shí)段數(shù)N 請(qǐng)輸入哪個(gè)時(shí)段發(fā)生故障Ni 請(qǐng)輸入每時(shí)段間隔的時(shí)間dt
標(biāo)簽: 電力系統(tǒng) 正 計(jì)算 運(yùn)行
上傳時(shí)間: 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.
標(biāo)簽: Implemented following compile command
上傳時(shí)間: 2014-01-01
上傳用戶:lhc9102
一:需求分析 1. 問(wèn)題描述 魔王總是使用自己的一種非常精練而抽象的語(yǔ)言講話,沒(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),把 他的話解釋成人能聽(tīng)得懂的話. 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ō)的話是:"天上一只鵝地上一只鵝鵝追鵝趕鵝下鵝蛋鵝恨鵝天上一只鵝地上一只鵝". | t | d | s | a | e | z | g | x | n | h | | 天 | 地 | 上 | 一只| 鵝 | 追 | 趕 | 下 | 蛋 | 恨 |
上傳時(shí)間: 2014-12-02
上傳用戶:jkhjkh1982
數(shù)據(jù)結(jié)構(gòu) 1、算法思路: 哈夫曼樹(shù)算法:a)根據(jù)給定的n個(gè)權(quán)值{W1,W2… ,Wn }構(gòu)成 n棵二叉樹(shù)的集合F={T1,T2…,T n },其中每棵二叉樹(shù)T中只有一個(gè)帶權(quán)為W i的根結(jié)點(diǎn),其左右子樹(shù)均空;b)在F中選取兩棵根結(jié)點(diǎn)的權(quán)值最小的樹(shù)作為左右子樹(shù)構(gòu)造一棵新的二叉樹(shù),且置新的二叉樹(shù)的根結(jié)點(diǎn)的權(quán)值為其左、右子樹(shù)上結(jié)點(diǎn)的權(quán)值之和;c)F中刪除這兩棵樹(shù),同時(shí)將新得到的二叉樹(shù)加入F中; d)重復(fù)b)和c),直到F只含一棵樹(shù)為止。
標(biāo)簽: 算法 W1 數(shù)據(jù)結(jié)構(gòu) 樹(shù)
上傳時(shí)間: 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.
標(biāo)簽: appropriate probability suggested1 intercept
上傳時(shí)間: 2017-01-03
上傳用戶:kr770906
將魔王的語(yǔ)言抽象為人類的語(yǔ)言:魔王語(yǔ)言由以下兩種規(guī)則由人的語(yǔ)言逐步抽象上去的:α-〉β1β2β3…βm ;θδ1δ2…-〉θδnθδn-1…θδ1 設(shè)大寫(xiě)字母表示魔王的語(yǔ)言,小寫(xiě)字母表示人的語(yǔ)言B-〉tAdA,A-〉sae,eg:B(ehnxgz)B解釋為tsaedsaeezegexenehetsaedsae對(duì)應(yīng)的話是:“天上一只鵝地上一只鵝鵝追鵝趕鵝下鵝蛋鵝恨鵝天上一只鵝地上一只鵝”。(t-天d-地s-上a-一只e-鵝z-追g-趕x-下n-蛋h-恨)
上傳時(shí)間: 2013-12-19
上傳用戶:aix008
【問(wèn)題描述】 在一個(gè)N*N的點(diǎn)陣中,如N=4,你現(xiàn)在站在(1,1),出口在(4,4)。你可以通過(guò)上、下、左、右四種移動(dòng)方法,在迷宮內(nèi)行走,但是同一個(gè)位置不可以訪問(wèn)兩次,亦不可以越界。表格最上面的一行加黑數(shù)字A[1..4]分別表示迷宮第I列中需要訪問(wèn)并僅可以訪問(wèn)的格子數(shù)。右邊一行加下劃線數(shù)字B[1..4]則表示迷宮第I行需要訪問(wèn)并僅可以訪問(wèn)的格子數(shù)。如圖中帶括號(hào)紅色數(shù)字就是一條符合條件的路線。 給定N,A[1..N] B[1..N]。輸出一條符合條件的路線,若無(wú)解,輸出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個(gè)數(shù),表示a[1]..a[n]。第三行有n個(gè)數(shù),表示b[1]..b[n]。 【輸出格式】 僅有一行。若有解則輸出一條可行路線,否則輸出“NO ANSWER”。
標(biāo)簽: 點(diǎn)陣
上傳時(shí)間: 2014-06-21
上傳用戶:llandlu
第一節(jié)、samba是干什么的?它有什么用? Samba(SMB是其縮寫(xiě)) 是一個(gè)網(wǎng)絡(luò)服務(wù)器,它是Linux作為本地服務(wù)器最重要的一個(gè)服務(wù),用于Linux和Windows共享文件之用;Samba可以用于Windows和 Linux之間的共享文件,也一樣用于Linux和Linux之間的共享文件;不過(guò)對(duì)于Linux和Linux之間共享文件有更好的網(wǎng)絡(luò)文件系統(tǒng) NFS,NFS也是需要架設(shè)服務(wù)器的; 2、安裝及服務(wù)操作命令 安裝samba程序非常簡(jiǎn)單,使用rpm -q samba查看當(dāng)前系統(tǒng)是否已經(jīng)安裝了samba軟件。 如果沒(méi)有那就進(jìn)入光盤(pán),rpm -ivh *samba*.rpm即可。 仔細(xì)說(shuō)下安裝的包: samba-common-3.0.28-0.el5.8 //samba服務(wù)器和客戶端中的最基本文件 samba-3.0.28-0.el5.8 //samba服務(wù)器核心軟件包 system-config-samba-1.2.39-1.el5 //samba圖形配置界面 samba-client-3.0.28-0.el5.8 //samba客戶端軟件 啟動(dòng)、暫停和停止服務(wù): /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é)、由最簡(jiǎn)單的一個(gè)例子說(shuō)起,匿名用戶可讀可寫(xiě)的實(shí)現(xiàn) 第一步: 更改smb.conf 我們來(lái)實(shí)現(xiàn)一個(gè)最簡(jiǎn)單的功能,讓所有用戶可以讀寫(xiě)一個(gè)Samba 服務(wù)器共享的一個(gè)文件夾;我們要改動(dòng)一下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 & 然后我們把下面這段寫(xiě)入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]這段是全局配置,是必段寫(xiě)的。其中有如下的幾行; workgroup 就是Windows中顯示的工作組;在這里我設(shè)置的是WORKGROUP (用大寫(xiě)); netbios name 就是在Windows中顯示出來(lái)的計(jì)算機(jī)名; server string 就是Samba服務(wù)器說(shuō)明,可以自己來(lái)定義;這個(gè)不是什么重要的; security 這是驗(yàn)證和登錄方式,這里我們用了share ;驗(yàn)證方式有好多種,這是其中一種;另外一種常用的是user的驗(yàn)證方式;如果用share呢,就是不用設(shè)置用戶和密碼了; [test] 這個(gè)在Windows中顯示出來(lái)是共享的目錄; path = 可以設(shè)置要共享的目錄放在哪里; writeable 是否可寫(xiě),這里我設(shè)置為可寫(xiě); browseable 是否可以瀏覽,可以;可以瀏覽意味著,我們?cè)诠ぷ鹘M下能看到共享文件夾。如果您不想顯示出來(lái),那就設(shè)置為 browseable=no,guest ok 匿名用戶以guest身份是登錄; 第二步:建立相應(yīng)目錄并授權(quán) [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 注釋:關(guān)于授權(quán)nobody,我們先用id命令查看了nobody用戶的信息,發(fā)現(xiàn)他的用戶組也是nobody,我們要以這個(gè)為準(zhǔn)。有些系統(tǒng)nobody用戶組并非是nobody ; 第三步:?jiǎn)?dòng)服務(wù)器 第四步:訪問(wèn)Samba 服務(wù)器的共享; 1、在Linux 中您可以用下面的命令來(lái)訪問(wèn); [root@localhost ~]# smbclient -L //liukai或 smbclient //192.168.0.94/test Password: 注:直接按回車 2、在Windows中,您可以用下面的辦法來(lái)訪問(wèn); \\liukai 或 \\192.168.0.94 3、說(shuō)明:如果用了netbiosname,就可以用“\\主機(jī)名”來(lái)訪問(wèn),如果沒(méi)用netbiosname,就不能用主機(jī)名訪問(wèn)。 第三節(jié)、簡(jiǎn)單的密碼驗(yàn)證服務(wù)器 修改smb.conf文件: security = user guest account = liukai encrypt passwords = yes smb passwd file = /etc/samba/smbpasswd 然后,建立一個(gè)新用戶 useradd liukai passwd liukai 成功后,cat /etc/passwd | mksmbpasswd.sh > /etc/samba/smbpasswd smbpasswd -a liukai 這就成功地添加了一個(gè)smb用戶。 重啟服務(wù),使用這個(gè)用戶進(jìn)行登錄即可。
上傳時(shí)間: 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.
標(biāo)簽: matlab fft
上傳時(shí)間: 2015-11-23
上傳用戶:石灰?guī)r123
蟲(chóng)蟲(chóng)下載站版權(quán)所有 京ICP備2021023401號(hào)-1