上一页 1 ··· 3 4 5 6 7 8 9 下一页

2013年10月31日

摘要: ParencodingsTime Limit:1000MSMemory Limit:10000KTotal Submissions:17819Accepted:10715DescriptionLet S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways:q By an integer sequence P = p1 p2...pn where pi is the number of left parentheses before the ith right p 阅读全文
posted @ 2013-10-31 18:59 程序猿猿猿 阅读(167) 评论(0) 推荐(0) 编辑
摘要: Web NavigationTime Limit:1000MSMemory Limit:10000KTotal Submissions:27086Accepted:12109DescriptionStandard web browsers contain features to move backward and forward among the pages recently visited. One way to implement these features is to use two stacks to keep track of the pages that can be reac 阅读全文
posted @ 2013-10-31 14:58 程序猿猿猿 阅读(260) 评论(0) 推荐(0) 编辑

2013年10月27日

摘要: proj 1007:DNA SortingTime Limit:1000MSMemory Limit:10000KTotal Submissions:76307Accepted:30599DescriptionOne measure of ``unsortedness'' in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, in the letter sequence ``DAABEC'', 阅读全文
posted @ 2013-10-27 15:35 程序猿猿猿 阅读(209) 评论(0) 推荐(0) 编辑
摘要: Maya CalendarTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 63165Accepted: 19479DescriptionDuring his last sabbatical, professor M. A. Ya made a surprising discovery about the old Maya calendar. From an old knotted message, professor discovered that the Maya civilization used a 365 day lon 阅读全文
posted @ 2013-10-27 00:40 程序猿猿猿 阅读(206) 评论(0) 推荐(0) 编辑

2013年10月25日

摘要: proj1003:HangoverTime Limit:1000MSMemory Limit:10000KTotal Submissions:93180Accepted:45118DescriptionHow far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We're assuming that the cards must be perpendicular to the 阅读全文
posted @ 2013-10-25 22:31 程序猿猿猿 阅读(269) 评论(0) 推荐(0) 编辑

2013年10月24日

摘要: void merge(int *A,int p,int q,int r){//归并排序 合并数组部分int *temp1 = new int[q-p+1];int *temp2 = new int[r-q+1];for(int i = 0;itemp2[flag2]){A[m+p] = temp2[flag2];flag2++;}else if(temp1[flag1]<=temp2[flag2]){A[m+p] = temp1[flag1];flag1++;}}}delete []temp1;delete []temp2;}void merge_sort(int *A,int p,in 阅读全文
posted @ 2013-10-24 08:54 程序猿猿猿 阅读(203) 评论(0) 推荐(0) 编辑

2013年10月23日

摘要: 无符号整型(U),有符号整型(T),以B表示二进制数,w表示有效位数。B2U表示二进制数据转化成无符号整型。 B2T:表示二进制数据转化成有符号数据。 U2T:无符号数据转化成有符号数据。 T2U:有符号转化成无符号数据。 c语言在处理同时包含有符号和无符号的表达式时,会隐含的将有符号转化成无符号,并假设这两个数都是非负的来执行这个运算。这对于标准的算术运算并无差异,但对关系运算来说,它会导致与直觉不相符的结果。当一个有符号和无符号数据比较是会将有符号数据转化成无符号数据在比较大小。如c语言在判断表达式(-10U),这与实际不符合。 阅读全文
posted @ 2013-10-23 16:18 程序猿猿猿 阅读(592) 评论(0) 推荐(0) 编辑

2013年10月22日

摘要: Description 有一头母牛,它每年年初生一头小母牛。每头小母牛从第四个年头开始,每年年初也生一头小母牛。请编程实现在第n年的时候,共有多少头母牛?Input 输入数据由多个测试实例组成,每个测试实例占一行,包括一个整数n(0<n<55),n的含义如题目中描述。n=0表示输入数据的结束,不做处理。 Output 对于每个测试实例,输出在第n年的时候母牛的数量。每个输出占一行。 Sample Input 2450 Sample Output 246 Source 一种错误的算法:int num_of_cows(int age,int year_left){if(year_lef 阅读全文
posted @ 2013-10-22 21:15 程序猿猿猿 阅读(8036) 评论(0) 推荐(0) 编辑

2013年10月21日

摘要: // shell_sort.cpp : 定义控制台应用程序的入口点。//#includeusing namespace std;/**以一定步长对数组中数字进行排序(a:待排序数组,len:数组长度,inc:步长,b:单步步长排序后数组,left:步长余量)*/void step_insert_so... 阅读全文
posted @ 2013-10-21 15:33 程序猿猿猿 阅读(413) 评论(0) 推荐(0) 编辑
摘要: 一、程序运行平台 不同的平台上对不同数据类型分配的字节数是不同的。 个人对平台的理解是CPU+OS+Compiler,是因为: 1、64位机器也可以装32位系统(x64装XP); 2、32位机器上可以有16/32位的编译器(XP上有tc是16位的,其他常见的是32位的); 3、即使是32位的编译器也可以弄出64位的integer来(int64)。 以上这些是基于常见的wintel平台,加上我们可能很少机会接触的其它平台(其它的CPU和OS),所以个人认为所谓平台的概念是三者的组合。 虽然三者的长度可以不一样,但显然相互配合(即长度相等,32位的CPU+32位的OS+32位的Com... 阅读全文
posted @ 2013-10-21 10:46 程序猿猿猿 阅读(147) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 下一页

导航