数字运算,判断一个数是否接近素数 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
中国象棋的Java版本 448 Chess$1.class 4,613 Chess.class 5,009 Chess.java 8,727 ChessBoard.class 13,867 ChessBoard.java 1,768 ChessPiece.class 1,301 ChessPiece.java 1,227 ChessPoint.class 989 ChessPoint.java 5,890 Demon.class 6,486 Demon.java 3,895 MakeChessManual.class 3,810 MakeChessManual.java 349 MoveStep.class 194 MoveStep.java 2,698 Rule.class 9,157 Rule.java
标签: Chess class ChessBoard Java
上传时间: 2015-10-08
上传用户:CHENKAI
n个元素{1,2, , n }有n!个不同的排列。将这n!个排列按字典序排列,并编号为0,1,…, n!-1。每个排列的编号为其字典序值。
上传时间: 2014-01-18
上传用户:日光微澜
C++高级参考手册 不错的一本参考书 前言 第1章 对象的演化 1 1.1 基本概念 1 1.1.1 对象:特性+行为 1 1.1.2 继承:类型关系 1 1.1.3 多态性 2 1.1.4 操作概念:OOP程序像什么 3 1.2 为什么C++会成功 3 1.2.1 较好的C 3 1.2.2 采用渐进的学习方式 4 1.2.3 运行效率 4 1.2.4 系统更容易表达和理解 4 1.2.5 “库”使你事半功倍 4 1.2.6 错误处理 5 1.2.7 大程序设计 5 1.3 方法学介绍 5 1.3.1 复杂性 5 1.3.2 内部原则 6 1.3.3 外部原则 7 1.3.4 对象设计的五个阶段 9 1.3.5 方法承诺什么 10 1.3.6 方法应当提供什么 10 1.4 起草:最小的方法 12 1.4.1 前提 13 1.4.2 高概念 14
上传时间: 2016-04-01
上传用户:stvnash
SHA-1(Secure Hash Algorithm)是美国国家标准局(National Institute of Standard and Technology NIST)为了配合数位签章演算法(Digital Signature Algorithm DSA)的使用所发布的联邦资讯处理标准-FIPS PUB 180-1(Federal Information Processing Standard Publication 180-1),而SHA-1 则是SHA-1 (FIPS180)的改良版,现今与MD5 皆广被使用拿来做密码验证功能.其设计的方法是根据MD4,来对输入的资料讯息(Message)产生出一个160 位元的讯息摘要(Digest) ,对於资料安全性提供了有效的保障.
标签: Technology Algorithm Institute National
上传时间: 2014-01-01
上传用户:gxf2016
基于BP神经网络的 参数自学习控制 (1)确定BP网络的结构,即确定输入层节点数M和隐含层节点数Q,并给出各层加权系数的初值 和 ,选定学习速率 和惯性系数 ,此时k=1; (2)采样得到rin(k)和yout(k),计算该时刻误差error(k)=rin(k)-yout(k); (3)计算神经网络NN各层神经元的输入、输出,NN输出层的输出即为PID控制器的三个可调参数 , , ; (4)根据(3.34)计算PID控制器的输出u(k); (5)进行神经网络学习,在线调整加权系数 和 ,实现PID控制参数的自适应调整; (6)置k=k+1,返回(1)。
上传时间: 2016-04-26
上传用户:无聊来刷下
S60-programming-a-tutorial-guide-symbian. 1 Introduction to Mobile-Phone Systems 1 1.1 Wireless Technologies 1 1.2 Cellular Systems 2 1.3 Elements of a Mobile-Phone System 4 1.4 Keeping Users’ Calls Separate 5 1.5 Multipath Propagation 7 1.6 2G Mobile-Phone Systems 9 1.7 GPRS Systems 10 1.8 3G Mobile-Phone Systems 13 1.9 IP Multimedia Subsystem 16 1.10 Mobile-Phone Hardware 17 2 Introduction to Symbian OS 19 Introduction 19 2.1 The Development of Symbian OS 20 2.2 Symbian OS User Interfaces 21 2.3 Coding Idioms 23 2.4 Tool Chains 28 3 The Console Application 33 Introduction 33 3.1 Creating a Console Application 33 3.2 CBase Classes 38 3.3 Protecting Memory 38 3.4 Putting It Into Practice: An Engine for a Simple Card Game 46 Summary 56
标签: programming-a-tutorial-guide-symb Introduction Mobile-Phone Wireless
上传时间: 2016-05-14
上传用户:dianxin61
Ex3-23 亲兄弟问题 « 问题描述: 给定n 个整数0 1 1 , , , n- a a a 组成的序列。序列中元素i a 的亲兄弟元素k a 定义为: min{ | } k i j n j j i a = a a ³ a < < 。 亲兄弟问题要求给定序列中每个元素的亲兄弟元素的位置。元素i a 的亲兄弟元素为k a 时,称k 为元素i a 的亲兄弟元素的位置。当元素i a 没有亲兄弟元素时,约定其亲兄弟元素 的位置为-1。 例如,当n=10,整数序列为6,1,4,3,6,2,4,7,3,5 时,相应的亲兄弟元素位 置序列为:4,2,4,4,7,6,7,-1,9,-1。 « 编程任务: 对于给定的n个整数0 1 1 , , , n- a a a 组成的序列,试用抽象数据类型栈,设计一个O(n) 时间算法,计算相应的亲兄弟元素位置序列。 « 数据输入: 由文件input.txt提供输入数据。文件的第1 行有1 个正整数n,表示给定给n个整数。 第2 行是0 1 1 , , , n- a a a 。 « 结果输出: 程序运行结束时,将计算出的与给定序列相应的亲兄弟元素位置序列输出到output.txt 中。 输入文件示例 输出文件示例 input.txt 10 4 2 4 4 7 6 7 -1 9 -1 output.txt 6 1 4 3 6 2 4 7 3 5
上传时间: 2013-12-17
上传用户:shizhanincc
求标准偏差 > function c=myfunction(x) > [m,n]=size(x) > t=0 > for i=1:numel(x) > t=t+x(i)*x(i) > end > c=sqrt(t/(m*n-1)) function c=myfunction(x) [m,n]=size(x) t=0 for i=1:m for j=1:n t=t+x(i,j)*x(i,j) end end c=sqrt(t/(m*n-1
标签: gt myfunction function numel
上传时间: 2014-09-03
上传用户:jjj0202
算法实现题2-9 排列的字典序问题 « 问题描述: n个元素{1,2, , n }有n!个不同的排列。将这n!个排列按字典序排列,并编号为0,1,…, n!-1。每个排列的编号为其字典序值。例如,当n=3时,6 个不同排列的字典序值如下: 字典序值 0 1 2 3 4 5 排列 123 132 213 231 312 321 « 编程任务: 给定n 以及n 个元素{1,2, , n }的一个排列,计算出这个排列的字典序值,以及按字 典序排列的下一个排列。
上传时间: 2014-12-05
上传用户:lanwei