題目:利用條件運算符的嵌套來完成此題:學習成績>=90分的同學用A表示,60-89分之間的用B表示,60分以下的用C表示。 1.程序分析:(a>b)?a:b這是條件運算符的基本例子。
上傳時間: 2015-01-08
上傳用戶:lifangyuan12
本“計算器”可以完成任意的通常借助手持計算器來完成的標準運算。“計算器”可用于基本的算術運算,比如加減運算等,以及C(清除)、AC(全部清零)、N(符號改變)、存儲(M+、M-、MR)、平方根和百分比運算。關于科學計算本“計算器”暫不支持。
上傳時間: 2014-10-28
上傳用戶:BOBOniu
排隊論中的一個仿真程序,主要是用于仿真M/M/1、M/D/1模型。輸入排隊模型相關參量,返回計算結果。
標簽: 仿真程序
上傳時間: 2015-03-04
上傳用戶:change0329
802.11b物理層的simulink建模。模型支持1Mbps, 2Mbps, 5.5Mbps, and 11Mbps 的模式,模型包括幀的生成,BPSK、QPSK調制,巴克碼擴展,CCK以及信道頻移量的選擇和一個AWGN信道。 使用說明:先將壓縮包解壓縮到一個新文件夾中,改變matlab當前執行目錄,然后運行WiFi.mdl文件。 壓縮包中包括6個文件:WiFi.mdl,WiFi_lib.mdl,WiFi_init.m,cck_codes.mat,ber_test.m,test_level_1.m。 模型使用標準:IEEE Std 802.11b-1999, 來源于: http://standards.ieee.org/reading/ieee/std/lanman/
上傳時間: 2014-08-05
上傳用戶:黑漆漆
算法介紹 矩陣求逆在程序中很常見,主要應用于求Billboard矩陣。按照定義的計算方法乘法運算,嚴重影響了性能。在需要大量Billboard矩陣運算時,矩陣求逆的優化能極大提高性能。這里要介紹的矩陣求逆算法稱為全選主元高斯-約旦法。 高斯-約旦法(全選主元)求逆的步驟如下: 首先,對于 k 從 0 到 n - 1 作如下幾步: 從第 k 行、第 k 列開始的右下角子陣中選取絕對值最大的元素,并記住次元素所在的行號和列號,在通過行交換和列交換將它交換到主元素位置上。這一步稱為全選主元。 m(k, k) = 1 / m(k, k) m(k, j) = m(k, j) * m(k, k),j = 0, 1, ..., n-1;j != k m(i, j) = m(i, j) - m(i, k) * m(k, j),i, j = 0, 1, ..., n-1;i, j != k m(i, k) = -m(i, k) * m(k, k),i = 0, 1, ..., n-1;i != k 最后,根據在全選主元過程中所記錄的行、列交換的信息進行恢復,恢復的原則如下:在全選主元過程中,先交換的行(列)后進行恢復;原來的行(列)交換用列(行)交換來恢復。
上傳時間: 2015-04-09
上傳用戶:wang5829
數字運算,判斷一個數是否接近素數 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
源代碼\用動態規劃算法計算序列關系個數 用關系"<"和"="將3個數a,b,c依次序排列時,有13種不同的序列關系: a=b=c,a=b<c,a<b=v,a<b<c,a<c<b a=c<b,b<a=c,b<a<c,b<c<a,b=c<a c<a=b,c<a<b,c<b<a 若要將n個數依序列,設計一個動態規劃算法,計算出有多少種不同的序列關系, 要求算法只占用O(n),只耗時O(n*n).
上傳時間: 2013-12-26
上傳用戶:siguazgb
The government of a small but important country has decided that the alphabet needs to be streamlined and reordered. Uppercase letters will be eliminated. They will issue a royal decree in the form of a String of B and A characters. The first character in the decree specifies whether a must come ( B )Before b in the new alphabet or ( A )After b . The second character determines the relative placement of b and c , etc. So, for example, "BAA" means that a must come Before b , b must come After c , and c must come After d . Any letters beyond these requirements are to be excluded, so if the decree specifies k comparisons then the new alphabet will contain the first k+1 lowercase letters of the current alphabet. Create a class Alphabet that contains the method choices that takes the decree as input and returns the number of possible new alphabets that conform to the decree. If more than 1,000,000,000 are possible, return -1. Definition
標簽: government streamline important alphabet
上傳時間: 2015-06-09
上傳用戶:weixiao99
實現阿克曼函數并統計遞歸調用次數 Counting times of recursion calling 1. 問題描述 定義阿克曼遞歸函數: ACK(0,n)=n+1 n>=0 ACK(m,0)=ACK(m-1,1) m>=1 ACK(m,n)=ACK(m-1,ACK(m,n-1)) m,n>0 2. 基本要求 讀入m、n,輸出ACK(m,n)的值,并統計遞歸調用次數。
標簽: recursion Counting calling times
上傳時間: 2015-06-11
上傳用戶:hgy9473
電力系統在臺穩定計算式電力系統不正常運行方式的一種計算。它的任務是已知電力系統某一正常運行狀態和受到某種擾動,計算電力系統所有發電機能否同步運行 1運行說明: 請輸入初始功率S0,形如a+bi 請輸入無限大系統母線電壓V0 請輸入系統等值電抗矩陣B 矩陣B有以下元素組成的行矩陣 1正常運行時的系統直軸等值電抗Xd 2故障運行時的系統直軸等值電抗X d 3故障切除后的系統直軸等值電抗 請輸入慣性時間常數Tj 請輸入時段數N 請輸入哪個時段發生故障Ni 請輸入每時段間隔的時間dt
上傳時間: 2015-06-13
上傳用戶:it男一枚