題目:利用條件運算符的嵌套來完成此題:學習成績>=90分的同學用A表示,60-89分之間的用B表示,60分以下的用C表示。 1.程序分析:(a>b)?a:b這是條件運算符的基本例子。
上傳時間: 2015-01-08
上傳用戶:lifangyuan12
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
電力系統在臺穩定計算式電力系統不正常運行方式的一種計算。它的任務是已知電力系統某一正常運行狀態和受到某種擾動,計算電力系統所有發電機能否同步運行 1運行說明: 請輸入初始功率S0,形如a+bi 請輸入無限大系統母線電壓V0 請輸入系統等值電抗矩陣B 矩陣B有以下元素組成的行矩陣 1正常運行時的系統直軸等值電抗Xd 2故障運行時的系統直軸等值電抗X d 3故障切除后的系統直軸等值電抗 請輸入慣性時間常數Tj 請輸入時段數N 請輸入哪個時段發生故障Ni 請輸入每時段間隔的時間dt
上傳時間: 2015-06-13
上傳用戶:it男一枚
一:需求分析 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
We have a group of N items (represented by integers from 1 to N), and we know that there is some total order defined for these items. You may assume that no two elements will be equal (for all a, b: a<b or b<a). However, it is expensive to compare two items. Your task is to make a number of comparisons, and then output the sorted order. The cost of determining if a < b is given by the bth integer of element a of costs (space delimited), which is the same as the ath integer of element b. Naturally, you will be judged on the total cost of the comparisons you make before outputting the sorted order. If your order is incorrect, you will receive a 0. Otherwise, your score will be opt/cost, where opt is the best cost anyone has achieved and cost is the total cost of the comparisons you make (so your score for a test case will be between 0 and 1). Your score for the problem will simply be the sum of your scores for the individual test cases.
標簽: represented integers group items
上傳時間: 2016-01-17
上傳用戶:jeffery
漢諾塔!!! Simulate the movement of the Towers of Hanoi puzzle Bonus is possible for using animation eg. if n = 2 A→B A→C B→C if n = 3 A→C A→B C→B A→C B→A B→C A→C
標簽: the animation Simulate movement
上傳時間: 2017-02-11
上傳用戶:waizhang
本代碼為編碼開關代碼,編碼開關也就是數字音響中的 360度旋轉的數字音量以及顯示器上用的(單鍵飛梭開 關)等類似鼠標滾輪的手動計數輸入設備。 我使用的編碼開關為5個引腳的,其中2個引腳為按下 轉輪開關(也就相當于鼠標中鍵)。另外3個引腳用來 檢測旋轉方向以及旋轉步數的檢測端。引腳分別為a,b,c b接地a,c分別接到P2.0和P2.1口并分別接兩個10K上拉 電阻,并且a,c需要分別對地接一個104的電容,否則 因為編碼開關的觸點抖動會引起輕微誤動作。本程序不 使用定時器,不占用中斷,不使用延時代碼,并對每個 細分步數進行判斷,避免一切誤動作,性能超級穩定。 我使用的編碼器是APLS的EC11B可以參照附件的時序圖 編碼器控制流水燈最能說明問題,下面是以一段流水 燈來演示。
上傳時間: 2017-07-03
上傳用戶:gaojiao1999
獲取計算機IP地址等網絡參數 UDP聊天程序 TCP聊天程序 瀏覽器的實現
標簽: 獲取計算機的名稱和IP地址 基本C/S模式的通信實驗
上傳時間: 2015-04-12
上傳用戶:scnbyh
基于FPGA的機器人視覺系統模塊的設計 關鍵字: 機器人 視覺系統 集成電路 FPGA 一、概述 視覺技術是近幾十年來發展的一門新興技術。機器視覺可以代替人類的視覺從事檢驗、目標跟蹤、機器人導向等方面的工作,特別是在那些需要重復、迅速的從圖象中獲取精確信息的場合。盡管在目前硬件和軟件技術條件下,機器視覺功能還處于初級水平,但其潛在的應用價值引起了世界各國的高度重視,發達國家如美國、日本、德國、法國等都投入了大量的人力物力進行研究,近年來已經在機器視覺的某些方面獲得了突破性的進展,機器視覺在車輛安全技術、自動化技術等應用中也越來越顯示出其重要價值。本文根據最新的CMOS圖像采集芯片設計了一種通用的視覺系統模塊,經過編制不同的圖像處理、模式識別算法程序本模塊可以應用到足球機器人,無人車輛等各種場合。
標簽: FPGA的機器人視覺系統
上傳時間: 2015-04-25
上傳用戶:justgo123
第一節、samba是干什么的?它有什么用? Samba(SMB是其縮寫) 是一個網絡服務器,它是Linux作為本地服務器最重要的一個服務,用于Linux和Windows共享文件之用;Samba可以用于Windows和 Linux之間的共享文件,也一樣用于Linux和Linux之間的共享文件;不過對于Linux和Linux之間共享文件有更好的網絡文件系統 NFS,NFS也是需要架設服務器的; 2、安裝及服務操作命令 安裝samba程序非常簡單,使用rpm -q samba查看當前系統是否已經安裝了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 第二節、由最簡單的一個例子說起,匿名用戶可讀可寫的實現 第一步: 更改smb.conf 我們來實現一個最簡單的功能,讓所有用戶可以讀寫一個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用戶的信息,發現他的用戶組也是nobody,我們要以這個為準。有些系統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,就不能用主機名訪問。 第三節、簡單的密碼驗證服務器 修改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