2008年4月23日

矩阵打印2

摘要: 用循环语句打印下列矩阵: (1,1) (1,2) (1,3) (1,4) (1,5) (1,6) (1,7) (2,1) (2,2) (2,3) (2,4) (2,5) (2,6) (2,7) (3,1) (3,2) (3,3) (3,4) (3,5) (3,6) (3,7) (4,... 阅读全文

posted @ 2008-04-23 23:21 哪热 阅读(131) 评论(0) 推荐(0) 编辑

矩阵打印1

摘要: 用循环语句打印下列矩阵: 1 0 1 2 3 4 5 6 2 1 2 3 4 5 6 0 3 2 3 4 5 6 0 1 4 3 4 5 6 0 1 2 5 4 5 6 ... 阅读全文

posted @ 2008-04-23 23:13 哪热 阅读(129) 评论(0) 推荐(0) 编辑

母牛生母牛

摘要: 若有一头母牛,从第四年开始每年生一头小母牛,按这个规律,第n年共有多少头母牛? Cow Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#include using namespace std; int main() { int n... 阅读全文

posted @ 2008-04-23 22:49 哪热 阅读(198) 评论(0) 推荐(0) 编辑

素数(Prime Number)

摘要: 输入一个数k,判断是不是素数 PrimeNumber Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#include #include using namespace std; int main() { int k; ... 阅读全文

posted @ 2008-04-23 00:41 哪热 阅读(176) 评论(0) 推荐(0) 编辑

完数

摘要: 一个数如果恰好等于它的因子之和,这个数就称为"完数"。例如,6的因子为1、2、3,而6=1+2+3,因此6是"完数"。编程找出1000之内的所有完数。 完数 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#include using n... 阅读全文

posted @ 2008-04-23 00:38 哪热 阅读(217) 评论(0) 推荐(0) 编辑

水仙花数

摘要: 打印出所有的"水仙花数"(Narcissus), 所谓"水仙花数"是指一个3位数,其各位数字立方和等于该数本身。例如, 153就是一水仙花数,因为153 = 13+53+33 Narcissus Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--... 阅读全文

posted @ 2008-04-23 00:34 哪热 阅读(360) 评论(0) 推荐(0) 编辑

猴子吃桃

摘要: 猴子第一天摘下若干桃子,当即吃了一半,还不过瘾,又多吃了一个。第二天早上又将剩下的桃子吃掉一半,又多吃了一个。以后每天早上都吃了前一天剩下的一半零一个。到第10天早上想再吃时,见只剩下一个桃子了。求第一天共摘多少桃子。 猴子吃桃 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeH... 阅读全文

posted @ 2008-04-23 00:29 哪热 阅读(308) 评论(0) 推荐(0) 编辑

百钱百鸡问题

摘要: 一百元买一百只鸡,公鸡7元一只,母鸡5元一只,小鸡1元3只,要求每样都要至少有一只。 百钱百鸡 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#include using namespace std; int main() { for(in... 阅读全文

posted @ 2008-04-23 00:19 哪热 阅读(183) 评论(0) 推荐(0) 编辑

输入X,计算级数

摘要: 输入X,计算级数 1 + x – x2/2! + x3/3! -… + (-1)n+1xn/n! x的级数 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#include #include using namespace std; int ... 阅读全文

posted @ 2008-04-23 00:13 哪热 阅读(358) 评论(0) 推荐(0) 编辑

2008年4月22日

求PI

摘要: 用高斯公式求PI: PI/4 = 1 – 1/3 + 1/5 – 1/7 +……. PI Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#include #include using namespace std; int main(... 阅读全文

posted @ 2008-04-22 23:44 哪热 阅读(197) 评论(0) 推荐(0) 编辑

导航