数字运算,判断一个数是否接近素数 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
一:需求分析 1. 问题描述 魔王总是使用自己的一种非常精练而抽象的语言讲话,没人能听懂,但他的语言是可逐步解释成人能听懂的语言,因为他的语言是由以下两种形式的规则由人的语言逐步抽象上去的: ----------------------------------------------------------- (1) a---> (B1)(B2)....(Bm) (2)[(op1)(p2)...(pn)]---->[o(pn)][o(p(n-1))].....[o(p1)o] ----------------------------------------------------------- 在这两种形式中,从左到右均表示解释.试写一个魔王语言的解释系统,把 他的话解释成人能听得懂的话. 2. 基本要求: 用下述两条具体规则和上述规则形式(2)实现.设大写字母表示魔王语言的词汇 小写字母表示人的语言的词汇 希腊字母表示可以用大写字母或小写字母代换的变量.魔王语言可含人的词汇. (1) B --> tAdA (2) A --> sae 3. 测试数据: B(ehnxgz)B 解释成 tsaedsaeezegexenehetsaedsae若将小写字母与汉字建立下表所示的对应关系,则魔王说的话是:"天上一只鹅地上一只鹅鹅追鹅赶鹅下鹅蛋鹅恨鹅天上一只鹅地上一只鹅". | t | d | s | a | e | z | g | x | n | h | | 天 | 地 | 上 | 一只| 鹅 | 追 | 赶 | 下 | 蛋 | 恨 |
上传时间: 2014-12-02
上传用户:jkhjkh1982
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
The XML Toolbox converts MATLAB data types (such as double, char, struct, complex, sparse, logical) of any level of nesting to XML format and vice versa. For example, >> project.name = MyProject >> project.id = 1234 >> project.param.a = 3.1415 >> project.param.b = 42 becomes with str=xml_format(project, off ) "<project> <name>MyProject</name> <id>1234</id> <param> <a>3.1415</a> <b>42</b> </param> </project>" On the other hand, if an XML string XStr is given, this can be converted easily to a MATLAB data type or structure V with the command V=xml_parse(XStr).
标签: converts Toolbox complex logical
上传时间: 2016-02-12
上传用户:a673761058
汉诺塔!!! Simulate the movement of the Towers of Hanoi puzzle Bonus is possible for using animation eg. if n = 2 A→B A→C B→C if n = 3 A→C A→B C→B A→C B→A B→C A→C
标签: the animation Simulate movement
上传时间: 2017-02-11
上传用户:waizhang
将魔王的语言抽象为人类的语言:魔王语言由以下两种规则由人的语言逐步抽象上去的:α-〉β1β2β3…βm ;θδ1δ2…-〉θδnθδn-1…θδ1 设大写字母表示魔王的语言,小写字母表示人的语言B-〉tAdA,A-〉sae,eg:B(ehnxgz)B解释为tsaedsaeezegexenehetsaedsae对应的话是:“天上一只鹅地上一只鹅鹅追鹅赶鹅下鹅蛋鹅恨鹅天上一只鹅地上一只鹅”。(t-天d-地s-上a-一只e-鹅z-追g-赶x-下n-蛋h-恨)
上传时间: 2013-12-19
上传用户:aix008
本代码为编码开关代码,编码开关也就是数字音响中的 360度旋转的数字音量以及显示器上用的(单键飞梭开 关)等类似鼠标滚轮的手动计数输入设备。 我使用的编码开关为5个引脚的,其中2个引脚为按下 转轮开关(也就相当于鼠标中键)。另外3个引脚用来 检测旋转方向以及旋转步数的检测端。引脚分别为a,b,c b接地a,c分别接到P2.0和P2.1口并分别接两个10K上拉 电阻,并且a,c需要分别对地接一个104的电容,否则 因为编码开关的触点抖动会引起轻微误动作。本程序不 使用定时器,不占用中断,不使用延时代码,并对每个 细分步数进行判断,避免一切误动作,性能超级稳定。 我使用的编码器是APLS的EC11B可以参照附件的时序图 编码器控制流水灯最能说明问题,下面是以一段流水 灯来演示。
上传时间: 2017-07-03
上传用户:gaojiao1999
#include "iostream" using namespace std; class Matrix { private: double** A; //矩阵A double *b; //向量b public: int size; Matrix(int ); ~Matrix(); friend double* Dooli(Matrix& ); void Input(); void Disp(); }; Matrix::Matrix(int x) { size=x; //为向量b分配空间并初始化为0 b=new double [x]; for(int j=0;j<x;j++) b[j]=0; //为向量A分配空间并初始化为0 A=new double* [x]; for(int i=0;i<x;i++) A[i]=new double [x]; for(int m=0;m<x;m++) for(int n=0;n<x;n++) A[m][n]=0; } Matrix::~Matrix() { cout<<"正在析构中~~~~"<<endl; delete b; for(int i=0;i<size;i++) delete A[i]; delete A; } void Matrix::Disp() { for(int i=0;i<size;i++) { for(int j=0;j<size;j++) cout<<A[i][j]<<" "; cout<<endl; } } void Matrix::Input() { cout<<"请输入A:"<<endl; for(int i=0;i<size;i++) for(int j=0;j<size;j++){ cout<<"第"<<i+1<<"行"<<"第"<<j+1<<"列:"<<endl; cin>>A[i][j]; } cout<<"请输入b:"<<endl; for(int j=0;j<size;j++){ cout<<"第"<<j+1<<"个:"<<endl; cin>>b[j]; } } double* Dooli(Matrix& A) { double *Xn=new double [A.size]; Matrix L(A.size),U(A.size); //分别求得U,L的第一行与第一列 for(int i=0;i<A.size;i++) U.A[0][i]=A.A[0][i]; for(int j=1;j<A.size;j++) L.A[j][0]=A.A[j][0]/U.A[0][0]; //分别求得U,L的第r行,第r列 double temp1=0,temp2=0; for(int r=1;r<A.size;r++){ //U for(int i=r;i<A.size;i++){ for(int k=0;k<r-1;k++) temp1=temp1+L.A[r][k]*U.A[k][i]; U.A[r][i]=A.A[r][i]-temp1; } //L for(int i=r+1;i<A.size;i++){ for(int k=0;k<r-1;k++) temp2=temp2+L.A[i][k]*U.A[k][r]; L.A[i][r]=(A.A[i][r]-temp2)/U.A[r][r]; } } cout<<"计算U得:"<<endl; U.Disp(); cout<<"计算L的:"<<endl; L.Disp(); double *Y=new double [A.size]; Y[0]=A.b[0]; for(int i=1;i<A.size;i++ ){ double temp3=0; for(int k=0;k<i-1;k++) temp3=temp3+L.A[i][k]*Y[k]; Y[i]=A.b[i]-temp3; } Xn[A.size-1]=Y[A.size-1]/U.A[A.size-1][A.size-1]; for(int i=A.size-1;i>=0;i--){ double temp4=0; for(int k=i+1;k<A.size;k++) temp4=temp4+U.A[i][k]*Xn[k]; Xn[i]=(Y[i]-temp4)/U.A[i][i]; } return Xn; } int main() { Matrix B(4); B.Input(); double *X; X=Dooli(B); cout<<"~~~~解得:"<<endl; for(int i=0;i<B.size;i++) cout<<"X["<<i<<"]:"<<X[i]<<" "; cout<<endl<<"呵呵呵呵呵"; return 0; }
标签: 道理特分解法
上传时间: 2018-05-20
上传用户:Aa123456789
1.05G2015-06-02 06:02 上海交大解码.rar 863KB2015-06-02 06:02 景桥播放器.rar 4.8M2015-06-02 06:02 大学课程专业软件.7z 6.6M2015-06-02 06:02 北师大ds专用播放器.rar 841KB2015-06-02 06:02 956浙江大学电子技术基础89讲视频教程(三分屏)(经典!).rar 7.12G2015-06-02 06:02 681 西北工业大学 高等数学下80讲 视频教程 3.52G2015-06-02 06:02 680 西北工业大学 高等数学上84讲 视频教程 3.41G2015-06-02 06:02 600西北工业大学电子技术64讲 视频教程 2.23G2015-06-02 06:02 599西北工业大学电工电子技术63讲 视频教程 2.68G2015-06-02 06:02 532浙江大学电工与电子技术32讲(csf版)视频教程 1.03G2015-06-02 06:02 349上海交大1327计算机应用基础25讲 视频教程 781.2M2015-06-02 06:02 336浙江大学计算机辅助数控编程技术 视频教程 1.06G2015-06-02 06:02 335上海交大2299计算机应用基础22讲 视频教程 819.8M2015-06-02 06:02 328上海交大2457计算机组成42讲 视频教程 1.62G2015-06-02 06:02 310浙江大学电子技术基础36讲(MP4版) 视频教程 1.7G2015-06-02 06:02 309浙江大学电子技术基础36讲(csf版) 视频教程 1.96G2015-06-02 06:02 290浙江大学电力电子技术32讲(csf版) 视频教程 1.43G2015-06-02 06:02 289浙江大学电力电子技术32讲(MP4版) 视频教程 1.07G2015-06-02 06:02 288浙江大学电力电子技术32讲(三分屏版) 视频教程 1.15G2015-06-02 06:02 287重庆大学电力电子技术113讲.rar 673.9M2015-06-02 06:02 286重庆大学模拟电子技术135讲.rar 2.14G2015-06-02 06:02 281武汉理工大学电工与电子技术71讲视频教程.rar 2.23G2015-06-02 06:02 219武汉理工大学计算机接口与通讯48讲视频教程.rar 974.2M2015-06-02 06:02 202 西安交大 高等数学下38讲 视频教程(www.study139.com提供).rar 461.5M2015-06-02 06:02 201高等数学 上 62讲 视频教程(www.study139.com提供)(1).rar 750.8M2015-06-02 06:02 2014-9-28--大学课程-密码.txt 2KB2015-06-02 06:02 2014-9-28----大学课程-密码.txt 2KB2015-06-02 06:02 2014-8-26-大学课程-密码.txt 1KB2015-06-02 06:02 2014-8-26--大学课程-密码.txt 1KB2015-06-02 06:02 2014-2---8---大学课程-密码.txt 3KB2015-06-02 06:02 2014-12---2---大学课程-密码.txt 3KB2015-06-02 06:02 2014-12---2----大学课程-密码.txt 3KB2015-06-02 06:02 2014-10---2----大学课程-密码.txt 2KB2015-06-02 06:02 2014-10----2----大学课程-密码.txt 2KB2015-06-02 06:02 176武汉理工大学模拟电子技术42讲视频教程.rar 1.57G2015-06-02 06:02 172武汉理工大学数字电子技术50讲视频教程.rar 1.23G2015-06-02 06:02 170上海交大2762电工电子技术36讲 视频教程 1.3G2015-06-02 06:02 169武汉理工大学武汉理工大学计算机软件技术基础31讲视频视频教程.rar 309.9M2015-06-02 06:02 1604002电子技术基础王小海 学习视频 1.28G2015-06-02 06:02 1604001电路原理范承志 学习视频 1.11G2015-06-02 06:02 150武汉理工大学高等数学104讲视频教程.rar 2.68G2015-06-02 06:02 139 上海交大 1453电子技术基础30讲 视频教程 1.66G2015-06-02 06:02 123 西安交大 数字电子技术69讲 视频教程 871M2015-06-02 06:02 121 西安交大 电工电子技术62讲 视频教程 616.1M2015-06-02 06:02 115 上海交大 2228电子技术基础40讲 视频教程 950.6M2015-06-02 06:02 114 上海交大 2228电子技术基础41讲 视频教程 113石油大学电路 视频教程 1.12G2015-06-02 06:02 113 西安交大 模拟电子技术70讲 视频教程 715.6M2015-06-02 06:02 099 西安交大 计算机网络原理54讲 视频教程 634.9M2015-06-02 06:02 097 西安交大 数字逻辑电路54讲 视频教程 091 东南大学 数字逻辑电路 1.75G2015-06-02 06:02 083 电子科技大学 计算机基础 视频教程 1.09G2015-06-02 06:02 082石油大学计算机组成原理 视频教程 1.16G2015-06-02 06:02 079西安电子科技大学模拟电子技术基础36讲+4辅导 视频教程 3.29G2015-06-02 06:02 075石油大学计算机操作系统 视频教程 1.22G2015-06-02 06:02 075 北师大 高等数学微积分(非经济类)视频教程 共77讲 146.9M2015-06-02 06:02 067哈工大电工电子技术基础64讲送讲义 4.13G2015-06-02 06:02 066西安电子科技大学高等数学(一)下36讲 1.77G2015-06-02 06:02 066 吉林大学 计算机操作系统 视频教程 1.66G2015-06-02 06:02 065西安电子科技大学高等数学(一)上36讲+4辅导 视频教程 063 吉林大学 电路电子技术 视频教程 6.06G2015-06-02 06:02 059 电子科技大学 射频模拟电路26讲 4.22G2015-06-02 06:02 058西安电子科技大学计算机系统结构31讲+4辅导 视频教程 1.59G2015-06-02 06:02 058 上海交大 2456计算机网络技术基础53讲 视频教程 054西安电子科技大学电子技术基础实验21讲 视频教程 051 东南大学 电路基础 1.03G2015-06-02 06:02 050西北工业大学电子技术64讲.rar 2.23G2015-06-02 06:02 049石油大学电力电子技术32讲 视频教程 420M2015-06-02 06:02 049 电子科技大学 电路分析基础68讲 视频教程 11.18G2015-06-02 06:02 047 哈工大 高等数学上下册98讲 3.17G2015-06-02 06:02 046石油大学数字电子技术 视频教程 1.02G2015-06-02 06:02 045天津大学_高等数学下_94讲.rar 9.32G2015-06-02 06:02 045石油大学模拟电子技术 视频教程 1.52G2015-06-02 06:02 044天津大学_高等数学上_95讲.rar 9.45G2015-06-02 06:02 044石油大学电路分析 视频教程 943.7M2015-06-02 06:02 044 电子科技大学 计算机系统结构34讲 5.12G2015-06-02 06:02 039 哈工大 计算机组成原理76讲 3.96G2015-06-02 06:02 032中南大学计算机原理与设计29讲 981.6M2015-06-02 06:02 029西安电子科技大学电子技术基础39讲视频教程 6.01G2015-06-02 06:02 029石油大学微积分 视频教程 2.9G2015-06-02 06:02 029 吉林大学 计算机组成原理 视频教程 1.42G2015-06-02 06:02 028 吉林大学 计算机系统结构 视频教程 028 哈工大 模拟电路76讲 1.66G2015-06-02 06:02 027中南大学计算机基础46讲 998.6M2015-06-02 06:02 027 哈工大 模拟电子技术40讲 1.65G2015-06-02 06:02 025 吉林大学 计算机网络基础 视频教程 1.3G2015-06-02 06:02 025 哈工大 数字电子技术基础52讲 1.66G2015-06-02 06:02 023 吉林大学 计算机接口技术及应用 视频教程 1.16G2015-06-02 06:02 022清华大学电子技术基础55讲视频教程(经典!!!) 4.53G2015-06-02 06:02 022 东南大学 东南大学计算机组成原理 视频教程 1.19G2015-06-02 06:02 019 北师大 高等数学(概率论)视频教程 共54讲 105.9M2015-06-02 06:02 018清华大学有机化学及实验49讲视频教程(经典!!! 018 北师大 高等数学(线性代数)视频教程 共66讲 129.5M2015-06-02 06:02 017 西安电子科技大学 电力电子技术50讲 视频教程 9.1G2015-06-02 06:02 017 北师大 高等数学(微积分)视频教程 共119讲 224.9M2015-06-02 06:02 014清华大学水力学39讲视频教程(经典!!! 2.7G2015-06-02 06:02 011华北电力大学数字电子技术基础43讲视频(经典!!!).rar 7.45G2015-06-02 06:02 010西南交大电子技术基础48讲 视频教程 2.23G2015-06-02 06:02 008清华大学计算机组成原理50讲视频教程(经典!!!) 4.27G2015-06-02 06:02 008南开大学计算机原理共34讲.rar 676.5M2015-06-02 06:02 008华北电力大学模拟电子技术基础51讲视频(经典!!!).rar 8.24G2015-06-02 06:02 007清华大学计算机语言与程序设计42讲视频教程(经典!!!) 3.37G2015-06-02 06:02 006清华大学计算机文化基础28讲视频教程(经典!!!) 3.77G2015-06-02 06:02 005 西安交大 电路100讲 视频教程 3.47G2015-06-02 06:02
标签: 电池
上传时间: 2013-06-25
上传用户:eeworm