摘要: #include using namespace std;//思想://如果a被一个奇数b整除,则它可以拆分成以a/b为中间数的连续的b个连续整数数之和;//如果a模一个偶数b的余数正好等于b/2,那么a可以分解为以a/b,a/b+1为两个中间数的b个连续整数之和。 int intCheck(int n){ for(int i=2; i > n; intCheck(n); return 0;} 阅读全文
posted @ 2013-08-27 17:49 倚天照花海 阅读(595) 评论(0) 推荐(0)
摘要: 1 #include 2 3 using namespace std; 4 5 //递归方法 6 int RGcd(int m, int n) 7 { 8 if(n>m) 9 swap(m,n);10 if(n==0)11 return m;12 else13 RGcd(n,m%n);14 }15 //迭代方法16 int RGcd(int m, int n)17 {18 if(n>m)19 swap(m,n);20 while... 阅读全文
posted @ 2013-08-23 17:48 倚天照花海 阅读(265) 评论(0) 推荐(0)