现在位置: 首页 > leo408236978发表的所有文章
  • 07月
  • 25日
综合 ⁄ 共 1002字 评论关闭
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order). The replacement must be in-place, do not allocate extra memory. Here are some examples. Inputs are in the left-hand column and its corresponding outputs are in the right-hand column.1,2,3 → 1,3,23,2,1 → 1,2,31,1,5 → 1,5,1 思路:其实我觉得这是一道......
阅读全文
  • 04月
  • 12日
算法 ⁄ 共 3663字 评论关闭
The Game Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 8640   Accepted: 2632 Description One morning, you wake up and think: "I am such a good programmer. Why not make some money?'' So you decide to write a computer game.  The game takes place on a rectangular board consisting of w * h squares. Each square might or might not contain a game piece, as shown in the picture.  One important aspect of the game is whether two game pieces can be connected by a path ......
阅读全文
  • 03月
  • 25日
综合 ⁄ 共 1108字 评论关闭
转载自:http://blog.csdn.net/flying881114/archive/2011/03/23/6272472.aspx 0. Runtime.exec()用来执行外部程序或命令 1. Runtime.exec() 有四种调用方法     * public Process exec(String command);     * public Process exec(String [] cmdArray);     * public Process exec(String command, String [] envp);     * public Process exec(String [] cmdArray, String [] envp);     2. 得到程序执行返回值, 0为success 需要用waitFor()函数,比如 Process p = Runtime.getRuntime().exec("javac"); (处理.......
阅读全文
  • 07月
  • 07日
综合 ⁄ 共 3218字 评论关闭
Qt从5.2版开始提供了两个类QCommandLineOption和QCommandLineParser来解析应用的命令行参数。 一、命令行写法 命令行:"-abc" 在QCommandLineParser的解析模式为ParseAsCompactedShortOptions(默认)时会被认为是3个参数,即"-a"、"-b"和"-c" QCommandLineOption op1("a"); QCommandLineOption op2("b"); QCommandLineOption op3("c"); QCommandLineParser parser; parser.addOption(op1); parser.addOption(op2); parser.addOption(op3); parser.process(a); qDebug() << parser.isSet(op1); // true qDebug() <<......
阅读全文
  • 06月
  • 05日
综合 ⁄ 共 792字 评论关闭
Hive的变量前面有一个命名空间,包括hiveconf、system、env,还有一个hivevar 1.hiveconf的命名空间指的是hive-site.xml下面的配置变量值。 2.system的命名空间是系统的变量,包括JVM的运行环境。 3.env的命名空间,是指环境变量,包括Shell环境下的变量信息,如HIVE_HOME之类的。 在Linux终端声明变量可以使用 --define key=value或者是--hivevar key=value来声明,这都代表是hivevar的变量。 如: # hive --define a='love' 可以简写为:hive -d key=value; 另外一种声明方式为:hive --hivevar key=value 添加多个变量的时候......
阅读全文
  • 05月
  • 16日
综合 ⁄ 共 441字 评论关闭
        一直想有个DC因十一打算外出,很想把外出的风景拍下来所以准备近期买一个DC,因本人对摄影是入门级加上预算的资金也不多,所以经过长时间的市场了解、观望最终选定了在3500左右的相机,有两款比较让我满意一是柯达的Z7590另一个是松下的FZ5。如果不是通过抵制日货的考虑我会选择FZ5,它性能比Z7590强:12X光学变焦还有超强防手抖功能。出于抵制日货的心理我想买柯达,可仔细一查柯达Z7590的详细资料,这款老美的相机居然是在日本设计的,还有部分产品是在日本生产的(也有部分是在上海生产的),哎真是可叹啊,现在的数码......
阅读全文
  • 05月
  • 03日
综合 ⁄ 共 596字 评论关闭
首先可以使用datediff函數計算出兩個日期的間隔天數,然後對於兩個日期之間包含了多少個週日,我們可以通過while迴圈,使用datepart函數來統計出週日的天數,最後將datediff計算的天數減去日期間的週日天數,也就能得到最後的結果了. sql函數如下所示: create  function  GetDaysDateDiff(@beginDate  smalldatetime ,@endDate smalldatetime)returns intasbegindeclare  @totalday   int,@countweek int,@countday int,@tempdate smalldatetimeset @countweek=0set @tempdate=@begindate while     datediff(day,@tempdate,@enddate)&g......
阅读全文
  • 04月
  • 15日
综合 ⁄ 共 954字 评论关闭
Linux 查看机器配置信息   #cat /proc/cpuinfo processor 从0开始计数,flags 如果有ht 说明和支持超线程技术(附1 )。 #cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c 1 Intel(R) Pentium(R) Dual CPU E2180 @ 2.00GHz 查看CPU信息,这里信息显示只有1个逻辑CPU,型号为 E2180 #cat /proc/cpuinfo | grep physical | uniq -c #getconf LONG_BIT 32 说明当前CPU运行在32bit模式下,但不代表CPU 不支持64bit # cat /proc/cpuinfo | grep flags | grep "lm" | wc -l 0 结果大于0,说明支持64位计算,......
阅读全文
  • 04月
  • 12日
综合 ⁄ 共 412字 评论关闭
P1098合唱队形 (DP) 描述 N位同学站成一排,音乐老师要请其中的(N-K)位同学出列,使得剩下的K位同学排成合唱队形。 合唱队形是指这样的一种队形:设K位同学从左到右依次编号为1,2…,K,他们的身高分别为T1,T2,…,TK, 则他们的身高满足T1<...<Ti>Ti+1>…>TK(1<=i<=K)。 你的任务是,已知所有N位同学的身高,计算最少需要几位同学出列,可以使得剩下的同学排成合唱队形。 格式 输入格式 输入的第一行是一个整数N(2<=N<=100),表示同学的总数。第一行有n个整数,用空格分隔,第i个整数T......
阅读全文
  • 02月
  • 16日
综合 ⁄ 共 1312字 评论关闭
手电筒是使用Android手机的闪光灯,所以需添加权限<uses-permission android:name="android.permission.CAMERA" /> 我测试的手机是三星I9300,正常,界面没有美化就有一个按钮,代码如下: package com.jwzhangjie; import com.jwzhangjie.test.R; import android.app.Activity; import android.hardware.Camera; import android.hardware.Camera.Parameters; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; /** * 手电筒 * @author ......
阅读全文
  • 01月
  • 19日
综合 ⁄ 共 2081字 评论关闭
You can Solve a Geometry Problem too Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7658    Accepted Submission(s): 3745 Problem Description Many geometry(几何)problems were designed in the ACM/ICPC. And now, I also prepare a geometry problem for this final exam. According to the experience of many ACMers, geometry problems are always much trouble, but this problem is very easy, after all we are now attending an exam, not a cont......
阅读全文
  • 12月
  • 27日
综合 ⁄ 共 1512字 评论关闭
方式一:使用?通配符,再通过set index //1 Session session = sessionFactory.openSession(); Query query = session.createQuery("select user.name from User as user where user.age > ?"); query.setInteger(0, 25); List names = query.list(); Iterator iterator = names.iterator(); while(iterator.hasNext()) { System.out.println(iterator.next()); } session.close(); //2 Session session = sf.getCurrentSession(); session.beginTransaction(); Query q = session.createQuery("from Cat......
阅读全文