数字运算,判断一个数是否接近素数 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
c语言版的多项式曲线拟合。 用最小二乘法进行曲线拟合. 用p-1 次多项式进行拟合,p<= 10 x,y 的第0个域x[0],y[0],没有用,有效数据从x[1],y[1] 开始 nNodeNum,有效数据节点的个数。 b,为输出的多项式系数,b[i] 为b[i-1]次项。b[0],没有用。 b,有10个元素ok。
上传时间: 2014-01-12
上传用户:变形金刚
数字通信系统的设计及其性能和所传输的数字信号的统计特性有关。所谓 加扰技术,就是不增加多余度而扰乱信号,改变数字信号的统计特性,使其近 似于白噪声统计特性的一种技术。这种技术的基础是建立在反馈移位寄存器序 列(伪随机序列)理论之上的。解扰是加扰的逆过程,恢复原始的数字信号。 如果数字信号具有周期性,则信号频谱为离散的谱线,由于电路的非线 性,在多路通信系统中,这些谱线对相邻信道的信号造成串扰。而短周期信号 经过扰码器后,周期序列变长,谱线频率变低,产生的非线性分量落入相邻信 道之外,因此干扰减小。 在有些数字通信设备中,从码元“0”和“1”的交变点提取定时信息,若 传输的数字信号中经常出现长的“1”或“0”游程,将影响位同步的建立和保 持。而扰码器输出的周期序列有足够多的“0”、“1”交变点,能够保证同步 定时信号的提取。
上传时间: 2014-01-23
上传用户:star_in_rain
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
用游标的方法实现对称差的计算,即 (A-B)+(B-A)
上传时间: 2016-05-23
上传用户:远远ssad
词法分析器 对输入一个函数,并对其分析main() { int a,b a = 10 b = a + 20 }
上传时间: 2013-12-20
上传用户:hfmm633
基因算法,用VC++或MATLAB,java等工具设计一程序计算任一个随机产生的DNA基因表达式的有效长度和值 设随机产生的基因表达式为: + Q - / b * b a Q b a a b a a b b a a a b
上传时间: 2014-01-09
上传用户:aa54
函数再现机构设计 试设计一曲柄摇杆机构,再现函数 要求: 输入构件的转角范围180°,输出构件摆角范围30°,即: 当输入构件从a转至a+90时,输出构件从b转至b+30 当输入构件从a+90转至a+180时,输出构件从b+30转至b
上传时间: 2013-12-17
上传用户:英雄
PS2键盘的单片机读取程序代码,单片机相应引脚与PS2连接,运行后,显示屏上显示按键,可以接条形码扫码器,调试通过
上传时间: 2014-01-07
上传用户:1079836864