`
OpenMind
  • 浏览: 177211 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论
文章列表
如果生成位于0到n-1之间的k个不重复的随机顺序的整数呢? /** * 随机抽取[0,n)之前的k个不同的数并随机排序,(k<=n) * * @param n * @param k * @return 随机排序的数组,长度为k */ public static int[] getRandomArray(int n, int k) { if (k > n) { k = n; } int[] rets = new int[k]; // 保存取出的随机数 int[] array = new int[n];// 定 ...
It is well known that if the square root of a natural number is not an integer, then it is irrational. The decimal expansion of such square roots is infinite without any repeating pattern at all. The square root of two is 1.41421356237309504880..., and the digital sum of the first one hundred decima ...
It is possible to write five as a sum in exactly six different ways: 4 + 1 3 + 2 3 + 1 + 1 2 + 2 + 1 2 + 1 + 1 + 1 1 + 1 + 1 + 1 + 1 How many different ways can one hundred be written as a sum of at least two positive integers? 下面是解题代码: public static void main(String[] args) { ...
It turns out that 12 cm is the smallest length of wire that can be bent to form an integer sided right angle triangle in exactly one way, but there are many more examples. 12 cm: (3,4,5) 24 cm: (6,8,10) 30 cm: (5,12,13) 36 cm: (9,12,15) 40 cm: (8,15,17) 48 cm: (12,16,20) In contrast, some lengths o ...
1),利用httpclient4.× 写一个http的客户端,模拟浏览器请求, public void post(List<NameValuePair> payload) throws Exception{ HttpPost post = new HttpPost(uri); HttpEntity result = null; try { UrlEncodedFormEntity entity = new UrlEncodedFormEntity(payload, ...
系统栏解除限制Ubuntu 11.X对顶部面板右上角的通知区域(系统托盘)采用了白名单制度,只有支持 Indicators 并位于白名单的部分程序才会被显示在系统托盘中,目前支持的程序有:'JavaEmbeddedFrame', 'Wine', 'scp-dbus-service',。 安装 dconf-tools:    sudo apt-get install dconf-tools 在终端中输入dconf-editor ,然后找到 desktop > unity > panel ,添加几个常用的的了,什么openfetion,stardict之类的(11.04把 systray ...
当有包冲突时,ubuntu更新会出现  Package System is Broken error的异常,解决方法: http://www.liberiangeek.net/2010/11/fix-package-system-broken-error-ubuntu-10-0410-10-maverick-meerkat/ 简要描述:通过 Synaptic Package Manager.找到Broken的包,然后remove,OK
1,设二维数组p的每行每列都按照下标递增的顺序递增。 用数学语言描述如下:p满足 (1),对任意的x1,x2,y,如果x1<x2,则p(x1,y)<p(x2,y); (2),对任意的x,y1,y2, 如果y1<y2,则p(x,y1)<p(x,y2); 2,问题: 给定满足1的数组p和一个整数k,求是否存在x0,y0使得p(x0,y0)=k? 3,算法分析: (1),穷举法,遍历二维数组,复杂度O(n*n),这个方法的代码我就不写了。 (2),二分搜索,复杂度为O(n*lgn),遍历每一行,每一列采用二分搜索。 //n*O(lgn) public static P ...
在javaeye上看到了一个二分搜索相关的提问http://www.iteye.com/topic/1118606,我设计了一个简洁高效的算法,这里贴出来: 题目:对于一个非递减数组A,存在A[i]=i,求o(lgn)的算法找出i, 分析: 1,对于任意的j和i,如果j>i则A[j]>=A[i]; 2,假设所求的解是I,即A[I]=I,则对任意的j,如果A[j]>j,可以得到I<j,如果A[j]<j,则j<I,如果A[j]=j,则j=I(不考虑I的多解情况). 利用2可以得到下面的算法: public static int search(int[] ...
我安装完ubuntu11.04后,分辨率是1024×768,不好看,而且从System Setting -> Monitors 进行设置也无法调上去,后面在网上看到一篇博客: http://forum.ubuntu.org.cn/viewtopic.php?f=48&t=346103 后,修改分辨率成功. 上文作者写出了自己的探索过程,我就直接写出最简单的设置方法吧: 主要过程: 1),选好自己适合分辨率,比如我的是1440×900, 终端运行: cvt 1440 900 输出: # 1440x900 59.89 Hz (CVT 1.30MA) hsync: 55.93 kHz ...
下边电脑维修教程网介绍几种不用打开机箱的方法就可以查看主板型号:        查看主板型号方法之一:开机后屏幕上出现bios自检画面时候按下pause键,上面显示了cpu、内存等信息。最下面的一行字里面则是主板型号(不同的主板显示的位置也有所不同)        查看主板型号方法之二:在“我的电脑”上点击右键——属性——硬件——设备管理器,从树结构中“系统设备”可以看到你主板的芯片组型号,从而推断主板的大致类型。(此方法适用于熟悉电脑硬件的朋友)        查看主板型号方法之三:在电脑左下角,开始——运行 输入 dxdiag  然后确定,在direct检查程序中可以看到主板的品牌、型号 ...
在windows下,可以直接\\ip\访问网络上的共享文件夹; 在linux下也类似这样: 打开ubuntu的文件管理系统,也可以用命令:nautilus,用ctl+L快捷方式打开location,输入 smb://192.168.6.111/  即可 当然如果没有安装smb,那就下载吧; http://wenku.baidu.com/view/079224ef102de2bd960588af.html
  W: GPG 错误:http://ppa.launchpad.net lucid Release: 由于没有公钥,无法验证下列签名: NO_PUBKEY FAF69C646FF368B7的问题 分类: linux 计算机使用常见问题 2011-09-08 11:32 255人阅读 评论 (0) 收藏 举报 在安装更新时 ...
下面是ubunut的源列表,详细见http://wiki.ubuntu.org.cn/index.php?title=Qref/Source&amp;variant=zh-cn, 经本人亲测,163和搜狐的好像都不行,我用了LupaWorld,速度还可以。   更新服务器(浙江杭州电信联通双线服务器),包含其他开源镜像 : deb http://mirror.lupaworld.com/ubuntu natty main restricted universe multiverse deb http://mirror.lupaworld.com/ubuntu natty ...
上文有说到xp下用grup4dos安装ubuntu11.04双系统的过程,下面介绍一下win7下安装ubuntu11.04的过程,与xp下不一样。 win7默认隐藏了一个分区,大小是100M左右,里面放置的是和win7启动相关的配置。 去google一下“win7 安装 ubuntu11.04 双系统” 可以看到很多详细的教程,比如: http://www.linuxidc.com/Linux/2010-10/29179.htm,我不赘述,这里只列出安装过程中容易出问题的几点。 1,去http://www.linuxidc.com/Linux/2007-12/10060.htm下载freeBC ...
Global site tag (gtag.js) - Google Analytics