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
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.
1. 下列說(shuō)法正確的是 ( )
A. Java語(yǔ)言不區(qū)分大小寫(xiě)
B. Java程序以類(lèi)為基本單位
C. JVM為Java虛擬機(jī)JVM的英文縮寫(xiě)
D. 運(yùn)行Java程序需要先安裝JDK
2. 下列說(shuō)法中錯(cuò)誤的是 ( )
A. Java語(yǔ)言是編譯執(zhí)行的
B. Java中使用了多進(jìn)程技術(shù)
C. Java的單行注視以//開(kāi)頭
D. Java語(yǔ)言具有很高的安全性
3. 下面不屬于Java語(yǔ)言特點(diǎn)的一項(xiàng)是( )
A. 安全性
B. 分布式
C. 移植性
D. 編譯執(zhí)行
4. 下列語(yǔ)句中,正確的項(xiàng)是 ( )
A . int $e,a,b=10
B. char c,d=’a’
C. float e=0.0d
D. double c=0.0f