会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
672530440
博客园
首页
新随笔
联系
管理
订阅
上一页
1
···
159
160
161
162
163
164
165
166
167
168
下一页
2015年5月26日
Arrays.sort(new String[]{"aaa"}); 排序方法
摘要: private static void mergeSort(Object[] src, Object[] dest, int low, int high, ...
阅读全文
posted @ 2015-05-26 10:04 无天666
阅读(750)
评论(0)
推荐(0)
2015年5月25日
给出一个数组A,找出一对 (i, j)使得A[i] <= A[j] (i < j)并且j-i最大
摘要: 题目:给出一个数组A,找出一对 (i, j)使得A[i] find(const vector &A) 2. { 3. int n = A.size(); 4. if(n == 0) 5. throw new invalid_argum...
阅读全文
posted @ 2015-05-25 22:37 无天666
阅读(1653)
评论(1)
推荐(0)
有序输出两棵二叉查找树中的元素
摘要: 题目:给出两棵二叉查找树,有序输出所有元素,时间复杂度O(n),空间复杂度O(h),h为树的高度此题就是把两棵二叉查找树的中序遍历过程结合在一起。structTreeNode{intval;TreeNode*left;TreeNode*right;TreeNode(intx):val(x),left...
阅读全文
posted @ 2015-05-25 18:00 无天666
阅读(228)
评论(0)
推荐(0)
2015年5月14日
1234567选择3个数字组合
摘要: public class cnk { public static void main(String[] args) { int[] n = new int[]{1,2,3,4,5,6,7}; int i0 = 0; int i1; int...
阅读全文
posted @ 2015-05-14 16:48 无天666
阅读(726)
评论(0)
推荐(0)
2015年5月13日
八皇后问题
摘要: 八皇后问题是一个古老而著名的问题,是回溯算法的典型例题。该问题是十九世纪著名的数学家高斯1850年提出:在国际象棋棋盘8行8列上摆放八个皇后,使其不能互相攻击,即任意两个皇后都不能处于同一行、同一列或同一斜线上,求有多少种摆放方法。#include int iCount = 0;//已经放了多少的皇...
阅读全文
posted @ 2015-05-13 11:12 无天666
阅读(280)
评论(0)
推荐(0)
2015年5月12日
矩阵乘法运算
摘要: //写出c[i][j]的数学递推式即可void MatrixMul(int **a,int **b, int **c, int x, int y, int z){ //a=m*n b=n*p int i,j,k; for (i=0;i<m;i++) //清空目标矩阵C的内容 ...
阅读全文
posted @ 2015-05-12 15:57 无天666
阅读(444)
评论(0)
推荐(0)
2015年5月10日
求π的近似值
摘要: int main(){ int i,n,sum=0; double x,y; printf("输入点的数量:"); scanf("%d",&n); srand(time(NULL)); //点落在阴影里面的次数除了总次数,得出概率,就为阴影部分的面积。...
阅读全文
posted @ 2015-05-10 13:25 无天666
阅读(326)
评论(0)
推荐(0)
证明不小于6的偶数都是两个素数之和
摘要: 所谓哥德巴赫猜想,是指哥德巴赫在教学中发现,每个不小于6的偶数都是两个素数之和。大家都相信这个猜想是正确的,但不能证明。 对于哥德巴赫猜想的验证,算法很简单,其基本思路是:设n为大于等于6的一个偶数,可将其分解为n1和n2两个数,分别检查n1和n2是否为素数,如都是,则在该数得到验证。若n1不是素数...
阅读全文
posted @ 2015-05-10 13:05 无天666
阅读(1033)
评论(0)
推荐(0)
最大公约数最小公倍数
摘要: int gcd(int a, int b) //最大公约数 { int m,n,r; m=a>=b?a:b; //m保存较大数 n=a<b?a:b; //n保存较小数 r=m%n; //求余数 while(r!=0) //辗转相除 { m=n...
阅读全文
posted @ 2015-05-10 10:16 无天666
阅读(282)
评论(0)
推荐(0)
2015年5月9日
亲密数
摘要: public class 亲密数{ public static void main(String argv [] ){ int a,i,b,n; System.out.println("There are following friendly-numbers pai...
阅读全文
posted @ 2015-05-09 16:53 无天666
阅读(443)
评论(0)
推荐(0)
上一页
1
···
159
160
161
162
163
164
165
166
167
168
下一页
公告