现在位置: 首页 > gelatin发表的所有文章
  • 11月
  • 03日
综合 ⁄ 共 1092字 评论关闭
              实现一个算法来判断一个字符串中的字符是否唯一(即没有重复).不能使用额外的数据结构。 (即只使用基本的数据结构)       是ASCII字符,还是只是26个字母? 还是有更大的字符集,对于不同的情况,可能会有不同的解决方案。 #include <iostream> #include <cstring> using namespace std; //如果字符时ASCII字符,则一共256个 //数组保存 bool isUnique1(string str) { bool array[256]; memset(array,0,sizeof(array)); int len = str.length(); for(int flag=0;flag<len;flag++) { int ve......
阅读全文
  • 10月
  • 08日
综合 ⁄ 共 404字 评论关闭
        今天晚上打算折腾下Ubuntu,想在一块移动硬盘上安装,但又在网上看到说可能会影响到本地硬盘(系统)中引导的问题,我怕出问题,就先把本地的windows7系统创建一个系统映像,大不了还原一下。结果用win7自带的”创建系统映像“时发生了错误, 三天前刷完系统马上创建了一个,那时还可以呢,听网上说需要开启Volume Shadow Copy等,我的确用360优化关掉了一些东西,好吧,就按着人家说的去做了,还是不行,后来就把感觉跟此有关的服务全打开了,结果依然不行。那就又返回去细看错误说明。里面说什么去看VSS和什么日志,好吧,......
阅读全文
  • 03月
  • 16日
综合 ⁄ 共 2574字 评论关闭
今天有一个dmp文件,要导入到新库中,进行了一次的操作。 [oracle@a2 u01]$ imp bj/bj file=/u01/bj.dmp fromuser=bj touser=tt log=/u01/imp.log Import: Release 11.1.0.6.0 - Production on Mon Nov 7 16:07:02 2011 Copyright (c) 1982, 2007, Oracle.  All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Export file created by EXPORT:V11.01.00 via conventional ......
阅读全文
  • 12月
  • 20日
综合 ⁄ 共 892字 评论关闭
给2个相同长度的2元字串,比较他们在相同位置的内容,并计算各位置内容不一样的总数,我们称该数為它们之间的Hamming distance。这任务可以经由对字串中各相同位置字元作XOR的运算或者做2进位的相加(但不进位)而得到。以下的例子為2个长度為10的2元字串A、B经过XOR运算。可以看出共有6个1,所以其Hamming distance為6。                                A      0 1 0 0 1 0 1 0 0 0                                B      1 1 0 1 0 1 0 1 0 0                             A XOR B = 1 0 0 1 1 1 1 1 0 0 你的任务是给你字串的......
阅读全文
  • 05月
  • 18日
综合 ⁄ 共 533字 评论关闭
转载自:http://hi.baidu.com/hgaha163/blog/item/df4c368f7b9f6ceaf11f3607.html import java.util.*; import javax.swing.*; public class Fudianshu { public static void main(String args[]){ String k = JOptionPane.showInputDialog("请输入你的浮点数!"); double x = Double.parseDouble(k); System.out.println("你输入的浮点数是:"+x); int m = (int)x; double y = x - m; System.out.println("整数部分:"+m); System.out.println("小数部分:"+y); System.exit(......
阅读全文
  • 05月
  • 15日
综合 ⁄ 共 47字 评论关闭
HCNE,HCSE.HCIE华为认证 CCNA,CCNP,CCIE思科认证 BENET北大青鸟认证
阅读全文
即要求每个顶点的连线不能少于两条,只需判断哪些点的连线只有一条后,而这些点重新连为2条边需添加的边数为(sum+1)/2.sum为连线只有一条的点个数。 #include<cstdio> #include<cstring> using namespace std; #define max 10001 int result[max]; int main() { int n,i,a,b; while(scanf("%d",&n)!=EOF) { memset(result,0,sizeof(result)); for(i=0;i<n-1;i++) { scanf("%d%d",&a,&b); result[a]++; result[b]++; ......
阅读全文
  • 02月
  • 22日
综合 ⁄ 共 2523字 评论关闭
Problem Description Given a specified total t and a list of n integers, find all distinct sums using numbers from the list that add up to t. For example, if t=4, n=6, and the list is [4,3,2,2,1,1], then there are four different sums that equal 4: 4,3+1,2+2, and 2+1+1.(A number can be used within a sum as many times as it appears in the list, and a single number counts as a sum.) Your job is to solve this problem in general. Input The input will contain one or more test cases, one per l......
阅读全文
  • 02月
  • 20日
综合 ⁄ 共 553字 评论关闭
come from:http://blog.csdn.net/swuteresa/article/details/9405383  1.确认以下编译器已安装: gcc --version g++ --version python --version 2.下载(默认至当前用户的Downloads目录下) URL: http://www.open-mpi.org/software/ompi/v1.6/ 目前版本:openmpi-1.6.5.tar.gz 3.解压openMPI安装文件,放在当前用户目录下: tar zxvf openmpi-1.6.5.tar.gz 4.进入安装文件目录 cd openmpi-1.6.5 5.安装openMPI(默认至目录:/usr/local/lib): ./configure 6.安装所有需要的文件: sudo make all inst......
阅读全文
  • 02月
  • 11日
综合 ⁄ 共 4745字 评论关闭
首先是jsp页面和脚本,为了方便写在一个里面  这是一个很常见的检测用户名是否存在的功能  这里用的是struts  <%@ page contentType="text/html; charset=GBK" %>  <html>  <head>  <title>  ajax  </title>  </head>  <body bgcolor="#ffffff">  <h1>  <input name="username" type="text" maxlength="20" />  <input id="chk-name-btn" type="button" value="检测帐号" onclick="testName(’<%=request.getContextPath()%>’)" />  <div id="view_name"&......
阅读全文
  • 12月
  • 17日
综合 ⁄ 共 2151字 评论关闭
一、启动android默认浏览器       Intent intent= new Intent();             intent.setAction("android.intent.action.VIEW");         Uri content_url = Uri.parse("http://www.cnblogs.com");        intent.setData(content_url);       startActivity(intent); 这样子,android就可以调用起手机默认的浏览器访问。   二、指定相应的浏览器访问 1、指定android自带的浏览器访问 ( “com.android.browser”:packagename   ;“com.android.browser.BrowserActivity”:启动主activity)                 Inten......
阅读全文
  • 11月
  • 22日
综合 ⁄ 共 194字 评论关闭
42.   昨日笔试:有四个人,他们每次一起出去玩的时候,用同时剪刀包袱锤的方式决定谁请客。设计一种方法,使得他们只需出一次,就可以决定请客的人,并且每个人请客的几率相同,均为 25%。 四个人,每个人都可能出剪刀包袱锤,假设分别为0,1,2; 则4个人,都有可能出0,1,2;加起来和为0-8; 计算出0-8,每个数字和出现的概率,平均分配给每个人即可,我没有计算; 如果加不行,在可以考虑乘等。。。
阅读全文