摘要: 问题:在嵌入式系统开发中,Modbus协议是工业控制系统中广泛应用的一种协议。本题用来简单模拟Modbus协议,只需根据条件生成符合该协议的数据帧,并解析所获取的数据。假设设备使用的协议发送数据格式如下: 其中前四项将在输入条件中给出,最后一项为CRC校验和,需根据前四项的数据,按照CRC算法... 阅读全文
posted @ 2015-05-16 23:37 chaoer 阅读(455) 评论(0) 推荐(0)
摘要: 问题:Input输入数据有多组。每组数据的第一行有两个正整数n,m(0 #include #include #include #include #include using namespace std; const int MAX = 1003; const int dirx[5] =... 阅读全文
posted @ 2015-05-16 22:53 chaoer 阅读(348) 评论(0) 推荐(0)
摘要: 问题:给你一个字符串,然后让你把所有的前缀给找出来,并把它们在字符串中的出现次数相加,输出这个和写出算法。InputThe first line is a single integer T, indicating the number of test cases.For each case, the... 阅读全文
posted @ 2015-05-14 13:34 chaoer 阅读(154) 评论(0) 推荐(0)
摘要: 问题:When a number is expressed in decimal, the kth digit represents a multiple of 10k. (Digits are numbered from right to left, where the least signifi... 阅读全文
posted @ 2015-05-13 11:47 chaoer 阅读(354) 评论(0) 推荐(0)
摘要: 问题:给定一个数值,判断他是否等于一连串素数之和(这些素数必须是连续的)。输出满足条件的组合的个数。题解:预先求出连续的素数和。然后找到不大于n的最大素数,那么所有的组合(连续不断的素数)只可能在此范围内。一些正整数可以通过和一个或多个连续的素数表示。有多少这样的陈述是一个给定的正整数吗?例如,整数... 阅读全文
posted @ 2015-05-13 11:39 chaoer 阅读(357) 评论(0) 推荐(0)
摘要: 问题:给定两个正整数,计算这两个数的最小公倍数并写出算法。Input输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数.Output对于每个测试用例,给出这两个数的最小公倍数,每个实例输出一行。Sample Input10 14Sample Output70回答:#include ... 阅读全文
posted @ 2015-05-12 10:18 chaoer 阅读(251) 评论(0) 推荐(0)
摘要: 问题:Consider a three-parameter recursive function w(a, b, c):if a 20 or b > 20 or c > 20, then w(a, b, c) returns:w(20, 20, 20)if a #include cons... 阅读全文
posted @ 2015-05-12 10:02 chaoer 阅读(169) 评论(0) 推荐(0)
摘要: 问题:InputThe input consists of one or more sets of strings, followed by a final line containing only the value 0. Each set starts with a line containin... 阅读全文
posted @ 2015-05-12 09:42 chaoer 阅读(319) 评论(0) 推荐(0)
摘要: 问题: 有三个正整数a,b,c(0int gcd(int a,int b){ returnb==0?a:gcd(b,a%b);}intmain(){ int n;scanf("%d",&n); inta,b,c,i;while(n--){scanf("%d%d",&a,&b);for(i=2;i<=... 阅读全文
posted @ 2015-05-11 16:17 chaoer 阅读(359) 评论(0) 推荐(0)
摘要: 问题:InputThe input consists of n cases, and the first line consists of one positive integer giving n. The next n lines each contain 3 integers, r, e an... 阅读全文
posted @ 2015-05-11 16:10 chaoer 阅读(197) 评论(0) 推荐(0)