11 2010 档案
排序之直接插入排序
摘要:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> #include #define M 100 ... 阅读全文
posted @ 2010-11-30 20:49 别人叫我军师 阅读(826) 评论(0) 推荐(0)
排序之冒泡排序
摘要:思想:首先是将第1个数和第2个数进行比较,若为逆序(R[1]>R[2]),则交换这两个数的位置,然后比较第2个数和第3数,以此类推,直至第n-1个数和第n个数进行比较为止.这个过程称为第一趟冒泡排序,排序结果是最大的数被排在了最后。即R[n]. 接着进行第二趟冒泡排序,即对前n-1个数再次进行两... 阅读全文
posted @ 2010-11-30 12:13 别人叫我军师 阅读(488) 评论(2) 推荐(2)
排序索引
摘要:直接插入排序 希尔排序 选择排序 冒泡排序 阅读全文
posted @ 2010-11-30 11:57 别人叫我军师 阅读(198) 评论(0) 推荐(0)
猴子吃桃问题
摘要:猴子吃桃问题。猴子第一天摘下若干个桃子,当即吃了一半,还不瘾,又多吃了一个第二天早上又将剩下的桃子吃掉一半,又多吃了一个。以后每天早上都吃了前一天剩下的一半零一个。到第10天早上想再吃时,见只剩下一个桃子了。求第一天共摘了多少。 Code highlighting produce... 阅读全文
posted @ 2010-11-30 10:58 别人叫我军师 阅读(2010) 评论(0) 推荐(0)
百马百担问题
摘要:百马百担问题,有100匹马,驮100担货,大马驮3担,中马驮2担,两匹小马驮1担,编程计算共有多少种驮法? Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlig... 阅读全文
posted @ 2010-11-29 22:44 别人叫我军师 阅读(2410) 评论(0) 推荐(0)
编写代码打印一下图形
摘要:1 123 12345 1234567 123456789 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> #incl... 阅读全文
posted @ 2010-11-29 21:54 别人叫我军师 阅读(411) 评论(0) 推荐(0)
求S=a+aa+aaa+....+aa...aaa之值,其中a是1~9之间的数字。
摘要:求Sn=a+aa+aaa+aaaa+...aa,其中a是1~9之间的数字。从键盘中输入a和n,例如:a=3,n=6时,表达式为S6=3+33+ 333+3333+33333+333333,其值为370368. Code highlighting produced by Actipro... 阅读全文
posted @ 2010-11-29 21:18 别人叫我军师 阅读(1834) 评论(1) 推荐(0)
求n!之和(即求1!+2!+3!+...+n!)
摘要:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> #include void main(){ in... 阅读全文
posted @ 2010-11-28 17:12 别人叫我军师 阅读(679) 评论(0) 推荐(0)
有一分数序列:2/1,3/2,5/3,8/5,13/8,21/13,.......,求这个数列的前20项之和
摘要:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> #include void main(){ floa... 阅读全文
posted @ 2010-11-28 16:58 别人叫我军师 阅读(1128) 评论(0) 推荐(0)
求100~1000之间个位数为6且被3整除的所有整数
摘要:代码 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> #include void ma... 阅读全文
posted @ 2010-11-28 15:21 别人叫我军师 阅读(488) 评论(0) 推荐(0)
求1~199之间的所有奇数之和
摘要:代码 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> #include void ma... 阅读全文
posted @ 2010-11-28 15:03 别人叫我军师 阅读(547) 评论(3) 推荐(0)
红白黑球组合问题
摘要:从3个红球、6个白球和7个黑球中,任意取出8个球作为一组输出,在每组中,可以没有黑球,但必须要有红球和白球 求总的组数以及每组的红球、白球、黑球的数目。 思路:红球取值范围为1个到3个,白球为1个到6个,黑球为0个到7个 代码 Code highlighting pr... 阅读全文
posted @ 2010-11-28 14:25 别人叫我军师 阅读(544) 评论(0) 推荐(0)
输入一行字符,分别统计出其中的英文字母、空格、数字、和其他字符的个数
摘要:代码 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> #include void ma... 阅读全文
posted @ 2010-11-28 14:00 别人叫我军师 阅读(746) 评论(0) 推荐(0)
输入一个整数n,求n的各位上的数字之积。
摘要:输入一个整数n,求n的各位上的数字之积。例如,若输入918,则输出应该是72,若输入360,则输出为 0。 思路:定义一个初始变量,并赋初始值为1。先求出输入的数的各个位的数字。并循环相乘。 代码 Code highlighting produced by Actip... 阅读全文
posted @ 2010-11-28 13:27 别人叫我军师 阅读(3921) 评论(0) 推荐(0)
打印图案
摘要:* * * **** * * * * * * * * * ** * * * * * * * 打印菱形图案。 代码 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www... 阅读全文
posted @ 2010-11-26 12:04 别人叫我军师 阅读(225) 评论(0) 推荐(0)
求100-200之间的全部素数
摘要:素数是除1和它本身之外不能被任何一个整数所整除的除1以外的自然数,比如:2,3,5,7是素数,而4,6,9等不是素数。 代码 Code highlighting produced by Actipro CodeHighlighter (freeware)http://w... 阅读全文
posted @ 2010-11-26 10:52 别人叫我军师 阅读(1968) 评论(0) 推荐(0)