虫虫首页|资源下载|资源专辑|精品软件
登录|注册

模版<b>教学大纲</b>模版

  • C++完美演绎 经典算法 如 /* 头文件:my_Include.h */ #include <stdio.h> /* 展开C语言的内建函数指令 */ #define PI 3.141

    C++完美演绎 经典算法 如 /* 头文件:my_Include.h */ #include <stdio.h> /* 展开C语言的内建函数指令 */ #define PI 3.1415926 /* 宏常量,在稍后章节再详解 */ #define circle(radius) (PI*radius*radius) /* 宏函数,圆的面积 */ /* 将比较数值大小的函数写在自编include文件内 */ int show_big_or_small (int a,int b,int c) { int tmp if (a>b) { tmp = a a = b b = tmp } if (b>c) { tmp = b b = c c = tmp } if (a>b) { tmp = a a = b b = tmp } printf("由小至大排序之后的结果:%d %d %d\n", a, b, c) } 程序执行结果: 由小至大排序之后的结果:1 2 3 可将内建函数的include文件展开在自编的include文件中 圆圈的面积是=201.0619264

    标签: my_Include include define 3.141

    上传时间: 2014-01-16

    上传用户:epson850

  • 数字运算

    数字运算,判断一个数是否接近素数 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

    源代码\用动态规划算法计算序列关系个数 用关系"<"和"="将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).

    标签: lt 源代码 动态规划 序列

    上传时间: 2013-12-26

    上传用户:siguazgb

  • c语言版的多项式曲线拟合。 用最小二乘法进行曲线拟合. 用p-1 次多项式进行拟合

    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。

    标签: 多项式 曲线拟合 c语言 最小二乘法

    上传时间: 2014-01-12

    上传用户:变形金刚

  • crc任意位生成多项式 任意位运算 自适应算法 循环冗余校验码(CRC

    crc任意位生成多项式 任意位运算 自适应算法 循环冗余校验码(CRC,Cyclic Redundancy Code)是采用多项式的 编码方式,这种方法把要发送的数据看成是一个多项式的系数 ,数据为bn-1bn-2…b1b0 (其中为0或1),则其对应的多项式为: bn-1Xn-1+bn-2Xn-2+…+b1X+b0 例如:数据“10010101”可以写为多项式 X7+X4+X2+1。 循环冗余校验CRC 循环冗余校验方法的原理如下: (1) 设要发送的数据对应的多项式为P(x)。 (2) 发送方和接收方约定一个生成多项式G(x),设该生成多项式 的最高次幂为r。 (3) 在数据块的末尾添加r个0,则其相对应的多项式为M(x)=XrP(x) 。(左移r位) (4) 用M(x)除以G(x),获得商Q(x)和余式R(x),则 M(x)=Q(x) ×G(x)+R(x)。 (5) 令T(x)=M(x)+R(x),采用模2运算,T(x)所对应的数据是在原数 据块的末尾加上余式所对应的数据得到的。 (6) 发送T(x)所对应的数据。 (7) 设接收端接收到的数据对应的多项式为T’(x),将T’(x)除以G(x) ,若余式为0,则认为没有错误,否则认为有错。

    标签: crc CRC 多项式 位运算

    上传时间: 2014-11-28

    上传用户:宋桃子

  • 这是清华大学编写的《高级语言程序设计A》

    这是清华大学编写的《高级语言程序设计A》,希望对你能有用,教学大纲(64学时03y350),有求必应。

    标签: 清华大学 编写 程序设计 高级语言

    上传时间: 2015-10-08

    上传用户:秦莞尔w

  • crc任意位生成多项式 任意位运算 自适应算法 循环冗余校验码(CRC

    crc任意位生成多项式 任意位运算 自适应算法 循环冗余校验码(CRC,Cyclic Redundancy Code)是采用多项式的 编码方式,这种方法把要发送的数据看成是一个多项式的系数 ,数据为bn-1bn-2…b1b0 (其中为0或1),则其对应的多项式为: bn-1Xn-1+bn-2Xn-2+…+b1X+b0 例如:数据“10010101”可以写为多项式 X7+X4+X2+1。 循环冗余校验CRC 循环冗余校验方法的原理如下: (1) 设要发送的数据对应的多项式为P(x)。 (2) 发送方和接收方约定一个生成多项式G(x),设该生成多项式 的最高次幂为r。 (3) 在数据块的末尾添加r个0,则其相对应的多项式为M(x)=XrP(x) 。(左移r位) (4) 用M(x)除以G(x),获得商Q(x)和余式R(x),则 M(x)=Q(x) ×G(x)+R(x)。 (5) 令T(x)=M(x)+R(x),采用模2运算,T(x)所对应的数据是在原数 据块的末尾加上余式所对应的数据得到的。 (6) 发送T(x)所对应的数据。 (7) 设接收端接收到的数据对应的多项式为T’(x),将T’(x)除以G(x) ,若余式为0,则认为没有错误,否则认为有错

    标签: crc CRC 多项式 位运算

    上传时间: 2014-01-15

    上传用户:hphh

  • We have a group of N items (represented by integers from 1 to N), and we know that there is some tot

    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-16

    上传用户:jeffery

  • 用游标的方法实现对称差的计算

    用游标的方法实现对称差的计算,即 (A-B)+(B-A)

    标签: 对称 计算

    上传时间: 2016-05-23

    上传用户:远远ssad

  • 词法分析器 对输入一个函数

    词法分析器 对输入一个函数,并对其分析main() { int a,b a = 10 b = a + 20 }

    标签: 分析器 函数 输入

    上传时间: 2013-12-20

    上传用户:hfmm633