當許多編程人員從事這項工作但又不使用源代碼管理工具時,源代碼管理幾乎不可能進行。Visual SourceSafe是Visual Basic的企業版配備的一個工具,不過這個工具目的是為了保留一個內部應用版本,不向公眾發布(應當說明的是,M i c r o s o f t并沒有開發Visual SourceSafe,它是M i c r o s o f t公司買來的) 。雖然Visual SourceSafe有幫助文本可供參考,但該程序的一般運行情況和在生產環境中安裝 Visual SourceSafe的進程都沒有詳細的文字說明。另外,Visual SourceSafe像大多數M i c r o s o f t應用程序那樣經過了很好的修飾,它包含的許多功能特征和物理特征都不符合 Microsoft Wi n d o w s應用程序的標準。例如,Visual SourceSafe的三個組件之一(Visual SourceSafe Administrator)甚至連F i l e菜單都沒有。另外,許多程序的菜單項不是放在最合適的菜單上。在程序開發環境中實現Visual SourceSafe時存在的復雜性,加上它的非標準化外觀和文檔資料的不充分,使得許多人無法實現和使用 Visual SourceSafe。許多人甚至沒有試用 Vi s u a l S o u r c e S a f e的勇氣。我知道許多高水平技術人員無法啟動Visual SourceSafe并使之運行,其中有一位是管理控制系統項目師。盡管如此,Visual SourceSafe仍然不失為一個很好的工具,如果你花點時間將它安裝在你的小組工作環境中,你一定會為此而感到非常高興。在本章中我并不是為你提供一些指導原則來幫助你創建更好的代碼,我的目的是告訴你如何使用工具來大幅度減少管理大型項目和開發小組所需的資源量,這個工具能夠很容易處理在沒有某種集成式解決方案情況下幾乎無法處理的各種問題。
數字運算,判斷一個數是否接近素數
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
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