题目:利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A表示,60-89分之间的用B表示,60分以下的用C表示。 1.程序分析:(a>b)?a:b这是条件运算符的基本例子。
上传时间: 2015-01-08
上传用户:lifangyuan12
源代码\用动态规划算法计算序列关系个数 用关系"<"和"="将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
上下文无关文法(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
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
第一部分 VISUAL C++实验环境介绍 ..........................................3 一、Visual C++简介 3 二、项目开发过程 4 三、集成开发环境Developer Studio 4 四、常用功能键及其意义 7 第二部分 实验 8 实验一 熟悉实验环境 8 实验二 简单程序开发 15 实验三 函数与程序结构 18 实验四 结构和类 21错误!未定义书签。 实验五 继承与虚函数 28 实验六 重载与文件I/O 33 实验七 面向对象程序设计(1) 35 实验八 面向对象程序设计(2) 47
上传时间: 2016-03-16
上传用户:songyue1991
实验源代码 //Warshall.cpp #include<stdio.h> void warshall(int k,int n) { int i , j, t; int temp[20][20]; for(int a=0;a<k;a++) { printf("请输入矩阵第%d 行元素:",a); for(int b=0;b<n;b++) { scanf ("%d",&temp[a][b]); } } for(i=0;i<k;i++){ for( j=0;j<k;j++){ if(temp[ j][i]==1) { for(t=0;t<n;t++) { temp[ j][t]=temp[i][t]||temp[ j][t]; } } } } printf("可传递闭包关系矩阵是:\n"); for(i=0;i<k;i++) { for( j=0;j<n;j++) { printf("%d", temp[i][ j]); } printf("\n"); } } void main() { printf("利用 Warshall 算法求二元关系的可传递闭包\n"); void warshall(int,int); int k , n; printf("请输入矩阵的行数 i: "); scanf("%d",&k); 四川大学实验报告 printf("请输入矩阵的列数 j: "); scanf("%d",&n); warshall(k,n); }
上传时间: 2016-06-27
上传用户:梁雪文以
#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
eeworm.com VIP专区 单片机源码系列 42资源包含以下内容:1. 基于红外模块的单片机电子密码锁安全性论证.rar2. 色环电阻计算.exe3. Proteus单片机仿真实例大全.rar4. MCS-51单片机开发板电路图.pdf5. 51单片机矩阵键盘的C语言程序与分析.doc6. 51单片机开发板原理图.pdf7. ADC0832中文资料.pdf8. 16X16LED点阵课程设计报告书.doc9. 热电偶冷端补偿电路的应用.pdf10. 单片机C语言例程.doc11. ARM启动代码的比较与实现.pdf12. 太阳能充电器设计.pdf13. TLP521-2-5525474.pdf14. 旋转时钟原理和程序.doc15. pcf8563 51单片机.rar16. 单片机c语言实例100.doc17. C51单片机C语言编程基础和实例.pdf18. 《创意电子设计与制作》随书光盘PCB图.rar19. 电工电路.pdf20. 单片机实现触摸键盘技术.doc21. 常用传感器以及常用外设简介.pdf22. 液晶显示电压proteus.rar23. [单片机原理及应用技术].李全利.文字版.pdf24. 单片机开发及应用技术--SPCE061A单片机教材书.pdf25. AVR单片机C语言开发入门指导.part2.rar26. ISP下载软件(非安装版).zip27. 单片机编程.rar28. 74HC595.pdf29. 循环冷却水水质处理.ppt30. 51单片机C语言编程入门(中科大).pdf31. 乐普编辑.exe32. c51单片机c语言教程.pdf33. 光敏和热敏电阻实验.rar34. 单片机小精灵v1.3完美破解.exe35. 看门狗电路的探讨.rar36. 单片机基础部分.rar37. mega48-88-168中文资料.pdf38. MCS-51系列89C2051单片机程序编写与烧录技术.pdf39. PC机及单片机数据通信技术.pdf40. C8051F系列配置工具.exe41. MSC-51单片机原理及接口技术-哈工大.pdf42. 自装单片机快速入门-单片机应用培训教材.pdf43. 单片机小精灵.exe44. 智能仪器(单片机应用系统设计) -刘大茂编著.pdf45. 74HC595串入并出芯片应用.rar46. 基于单片机的遥控开关设计2.doc47. MCS51 Boolen using.pdf48. C#函数手册.rar49. PROTEUS元件名称中英对照.doc50. 单片机开发软件KEIL.rar51. 单片机开发学习实例300.docx52. 基于51单片机和DS18B20的数字温度计设计.doc53. 51单片机C语言编程手册.pdf54. 89c51单片改造传统接触器式自动控制的小型注塑机程序.doc55. LCD12864做的强大模拟电子钟.rar56. 华为技术手册.pdf57. 用C语言实现高效嵌入式编程.pdf58. HOT-51电路图.pdf59. Cx51中文手册.pdf60. 编程修养.pdf61. AD0809中文资料.pdf62. 很全的电子元器件基础知识讲义.pdf63. 红外遥控知识论文集打包(原创作品,带书签).pdf64. PCB工艺设计规范.pdf65. 单片机c语言实例100.rar66. TKStudio和SDCC_8051使用入门 - 17.pdf67. xs128中文资料.docx68. 单片机器件应用手册.pdf69. LY-51S c语言 程序.rar70. MQ8氢气检测传感器说明书V1.1.rar71. 89c51rc.pdf72. 单片机模糊控制系统设计与应用实例.pdf73. STM8S工程模板.pdf74. 51单片机新手实例学习[1].pdf75. AT89s51中文资料.pdf76. 30章Keil C51入门教程.rar77. MSP430使用指南.pdf78. 51单片机C语言编程手册.rar79. 51简易计算器_lcd1602.zip80. 51波特率初值设定.exe81. MSC-51单片机(有史以来,最简单易懂教程).pdf82. C程序设计语言.pdf83. w77e58中文资料.pdf84. AVR_examples proteus examples.rar85. 多功能电子时钟.rar86. 1602液晶说明.pdf87. MEGA16制作的电子时钟(附仿真图+源代码).rar88. STC89C51RC介绍.pdf89. 基于单片机的数字时钟C语言设计.rar90. 单片机字模转换软件.zip91. W5100在单片机实现以太网通信中的应用.rar92. ATtiny15(中文修订版).pdf93. 竞赛专用芯片资料.rar94. MSC-51单片机(有史以来,最简单易懂教程).pdf95. AVR单片机数码管秒表显示.rar96. 51端口的结构及工作原理.pdf97. C语言也能干大事全部板书(带书签).pdf98. 51单片机精简教程.doc99. 4×4 矩阵键盘电路的改进.pdf100. 项目三 测控数据显示之三LED点阵模块.doc
上传时间: 2013-04-15
上传用户:eeworm