2014年3月2日

递归函数练习——累乘

摘要: /*=====================================求1*2*3*……*n的值======================================*/#includeint leiCheng(int begin,int end); int jieCheng(int ... 阅读全文

posted @ 2014-03-02 16:07 华山青竹 阅读(854) 评论(0) 推荐(0)

递归练习——累加和

摘要: /*=================================用递归来计算1+2+3+……+n的值。 ===================================*/ 1 #include 2 long sum(long i); 3 int sum2(int a,int b); 4... 阅读全文

posted @ 2014-03-02 15:54 华山青竹 阅读(573) 评论(0) 推荐(0)

递归函数练习——输出角谷猜想各个步骤

摘要: /*=====================================角谷定理。输入一个自然数,若为偶数,则把它除以2,若为奇数,则把它乘以3加1。经过如此有限次运算后,总可以得到自然数值1。求经过多少次可得到自然数1。如:输入22,输出 22 11 34 17 52 26 13... 阅读全文

posted @ 2014-03-02 15:53 华山青竹 阅读(2042) 评论(0) 推荐(0)

递归练习:计算整数的各位数字之和

摘要: /*=====================================输入一个数,求这个数的各位数字之和。======================================*/ 1 #include 2 int fun(int n);//返回n的各位数字之和。递归函数. 3 in... 阅读全文

posted @ 2014-03-02 15:44 华山青竹 阅读(1238) 评论(0) 推荐(1)

Problem A+B(Big Integer)

摘要: /*========================================================================Problem A+B(Big Integer)Time Limit:1000MS Memory Limit:65536KBTotal Submit:3205 Accepted:922Description Give two positive integer A and B,calucate A+B.Notice that A,B is no more than 500 digits.Input The test case contain seve 阅读全文

posted @ 2014-03-02 13:40 华山青竹 阅读(703) 评论(0) 推荐(0)

导航