数字运算,判断一个数是否接近素数 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
MSP430单片机是TI公司1996年开始推向市场的超低功耗微处理器,另外他还集成了很多模块功能,从而使得用一片MSP430 芯片可以完成多片芯片才能完成的功能,大大缩小了产品的体积与成本。如今,MSP430单片机已经用于各个领域,尤其是仪器仪表、监测、医疗器械以及汽车电子等领域。
上传时间: 2014-01-17
上传用户:wpwpwlxwlx
引言 1.1 编写目的 编写本测试计划的目的是为整个测试阶段的管理工作和技术工作提供指南;同时确定测试的内容和范围,为评价系统提供依据;此外还帮助用户安排测试活动,说明对设备器材和机构人员的资源需求;说明测试结果的评价指标。 1.2 背景 说明本测试计划所属软件系统的名称、特征、要求和难点,以及在开始执行本测试计划之前必须完成的各项任务。 1.3 参考资料 《XX电子运行维护系统省内系统需求规范 V2.0》 《XX省EOMS系统需求规范 V1.5》 《概要设计说明书》 《软件需求规格说明书》 1.4 术语和缩写词 缩略语 EOMS:electronic operation and management system 2 任务概述
上传时间: 2013-12-10
上传用户:顶得柱
本程序,是汽车电子方面的到速雷达,利用收发同体超声波传感器,来测量车身里障碍物的距离,在1.5米内开始报警,在0.5米内连续报警。次项目能够在-40度到80度范围内不会误报。
标签: 程序
上传时间: 2014-12-21
上传用户:lx9076
此程序是无线发射与接收,也是汽车电子上的到速雷达,利用四路传声波传感器接受信号经高频无线发射,放在驾驶室里的接受装置,能够反映车后面的情况。并能够在液晶屏清晰显示在身的地点。
上传时间: 2015-09-17
上传用户:xz85592677
上下文无关文法(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
AT89S52原理图AT89S52是一种低功耗、高性能CMOS8位微控制器,具有8K 在系统可编程 Flash 存储器。使用 Atmel 公司高密度非 易失性存储器技术制造,与工业 80C51 产品指令和引脚完全兼容。片上Flash允许程序储器在系统可编程,亦适于常规编程器。在单芯片上,拥有灵巧的 8 位 CPU 和在系统可编程Flash,使得 AT89S52为众多嵌入式控制应用系统提供高灵活、超有效的解决方案。
上传时间: 2013-12-25
上传用户:qwe1234
这是一个用Java实现ElGamal加密解密和签名验证的算法,还包含了一个安全电子邮件发送系统。
上传时间: 2015-12-21
上传用户:lps11188