数字运算,判断一个数是否接近素数 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
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
自己编写的比较全面的故障诊断matlab函数程序,包括统计法、时域法、时间序列法、频谱及功率普密度函数、小波分析法程序中有详细的说明。
上传时间: 2015-07-21
上传用户:zhangzhenyu
在用混沌理论和神经网络进行短期负荷预测时,神经网络的输入的选择至关重要,该程序用matlabl实现了基于混沌时间序列的嵌入维数的选择
上传时间: 2015-08-10
上传用户:yangbo69
本程序时基于混沌理论和ELMAN神经网络的短期负荷预测,能取得很好的预测效果,直接使用该程序就能实现电力短期负荷预测,同样使用于其他类型的时间序列预测
上传时间: 2015-08-10
上传用户:wweqas
功能: 功率谱分析 算法参考文献:黄嘉佑,《气象时间序列分析》
上传时间: 2014-01-01
上传用户:13215175592
多通道奇异谱分析程序,可用于时间序列多尺度分析,多尺度比对与拼接等。
上传时间: 2013-12-12
上传用户:fxf126@126.com
上下文无关文法(Context-Free Grammar, CFG)是一个4元组G=(V, T, S, P),其中,V和T是不相交的有限集,S∈V,P是一组有限的产生式规则集,形如A→α,其中A∈V,且α∈(V∪T)*。V的元素称为非终结符,T的元素称为终结符,S是一个特殊的非终结符,称为文法开始符。 设G=(V, T, S, P)是一个CFG,则G产生的语言是所有可由G产生的字符串组成的集合,即L(G)={x∈T* | Sx}。一个语言L是上下文无关语言(Context-Free Language, CFL),当且仅当存在一个CFG G,使得L=L(G)。 *⇒ 例如,设文法G:S→AB A→aA|a B→bB|b 则L(G)={a^nb^m | n,m>=1} 其中非终结符都是大写字母,开始符都是S,终结符都是小写字母。
标签: Context-Free Grammar CFG
上传时间: 2013-12-10
上传用户:gaojiao1999
一个多输入多输出小波网络的源程序,用matlab编写,能够实现对时间序列数据的训练预测
上传时间: 2015-10-02
上传用户:ecooo
一个小波网络的源程序,用vc编写,能够实现对时间序列数据的训练预测
上传时间: 2013-12-09
上传用户:qwe1234