mydjm

 

2012年3月20日

合并排序

摘要: #include<stdio.h>#define MAX_INT 65535//哨兵void Merge(int *a,int p,int q,int r)//关键函数~ 合并{ int L[50],R[50],b[100],i,j,k; int len1=q-p+1; int len2=r-q; for(i=0;i<len1;i++) { L[i] = a[p+i]; } L[len1]=MAX_INT; //L[len1]=600; for(i=0;i<len2;i++) { R[i] = a[q+1+i]; } R[len2] = MAX_INT; //R[len 阅读全文

posted @ 2012-03-20 18:53 mydjm 阅读(186) 评论(0) 推荐(0) 编辑

2011年11月28日

poj1007

摘要: DescriptionOne 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'', this measure is 5, since D is greater than four letters to its right and E is greater than one 阅读全文

posted @ 2011-11-28 13:06 mydjm 阅读(147) 评论(0) 推荐(0) 编辑

2011年11月27日

世界名牌大学下载地址(zz)

摘要: 一、伯克利加州大学伯克利分校 http://webcast.berkeley.edu/courses.php作为美国第一的公立大学,伯克利分校提供了许多优秀教授的播客和视频讲座,可以跟踪最新的讲座。想看教授布置的作业和课堂笔记,可以点击该教授的网页,通常,他/她都会第一堂课留下网址。实在不行,用google搜搜吧! 伯克利的视频都是.rm格式,请注意转换 二、麻省麻省理工学院 http://ocw.mit.edu/OcwWeb/web/courses/courses/index.htm麻省理工是免费开放教育课件的先驱,计划在今年把1800门课程的课件都放在网站上,提供课程与作业的PDF格式.. 阅读全文

posted @ 2011-11-27 10:50 mydjm 阅读(322) 评论(0) 推荐(0) 编辑

2011年11月26日

poj1005

摘要: DescriptionFred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land, he learned that the state of Louisiana is actually shrinking by 50 square miles each year, due to erosion caused by the Mississippi River. Since Fred is hoping to 阅读全文

posted @ 2011-11-26 19:15 mydjm 阅读(1046) 评论(0) 推荐(0) 编辑

poj1004

摘要: InputThe input will be twelve lines. Each line will contain the closing balance of his bank account for a particular month. Each number will be positive and displayed to the penny. No dollar sign will be included.OutputThe output will be a single number, the average (mean) of the closing balances fo 阅读全文

posted @ 2011-11-26 14:15 mydjm 阅读(1425) 评论(0) 推荐(0) 编辑

poj1003

摘要: InputThe input consists of one or more test cases, followed by a line containing the number 0.00 that signals the end of the input. Each test case is a single line containing a positive floating-point number c whose value is at least 0.01 and at most 5.20; c will contain exactly three digits.OutputF 阅读全文

posted @ 2011-11-26 13:45 mydjm 阅读(1214) 评论(0) 推荐(0) 编辑

2011年11月19日

poj1002(木有字典升序输出)

摘要: Description企业喜欢用容易被记住的电话号码。让电话号码容易被记住的一个办法是将它写成一个容易记住的单词或者短语。例如,你需要给滑铁卢大学打电话时,可以拨打TUT-GLOP。有时,只将电话号码中部分数字拼写成单词。当你晚上回到酒店,可以通过拨打310-GINO来向Gino's订一份pizza。让电话号码容易被记住的另一个办法是以一种好记的方式对号码的数字进行分组。通过拨打必胜客的“三个十”号码3-10-10-10,你可以从他们那里订pizza。 电话号码的标准格式是七位十进制数,并在第三、第四位数字之间有一个连接符。电话拨号盘提供了从字母到数字的映射,映射关系如下: A, B, 阅读全文

posted @ 2011-11-19 16:28 mydjm 阅读(334) 评论(0) 推荐(0) 编辑

2011年11月16日

液晶显示器

该文被密码保护。 阅读全文

posted @ 2011-11-16 16:34 mydjm 阅读(12) 评论(0) 推荐(0) 编辑

2011年11月14日

地雷问题

摘要: 先输入矩阵行列数 然后输入矩阵元素 为“*”或者“.”。如果是*,则输出*,如果是.,则输出周围的地雷数输入:4 4*........*......输出:*10022101*101110输入:3 5**.........*...输出:**...332001*100 1 #include<stdio.h> 2 void main() 3 { 4 char c[10][10],h; 5 int i,j,m,n,count=0; 6 scanf("%d %d%c",&m,&n,&h);//m表示行 n表示列,加个h吸收回车 7 for(i=0; 阅读全文

posted @ 2011-11-14 20:17 mydjm 阅读(165) 评论(0) 推荐(0) 编辑

3n+1问题

摘要: 1 #include<stdio.h> 2 void main() 3 { 4 int i,j,k,m,count,max; 5 while(scanf("%d %d",&i,&j)!=EOF) 6 { 7 m=i;count=0,max=0;//m用于保存i 8 for(k=i;i<=j;k=i) 9 {10 while(k!=1)//缺点 直接忽略了i=1的情况11 {12 if(k%2==0) k=k/2;13 ... 阅读全文

posted @ 2011-11-14 10:26 mydjm 阅读(203) 评论(0) 推荐(0) 编辑

导航