- 博客(125)
- 资源 (1)
- 收藏
- 关注
原创 poj-2777
// 3756K 719MS G++ #include #include #include using namespace std;struct TreeNode { // 0: no color, >= 1, whole cover by one color, -1: one color // , but not whole covered, -2: >
2014-07-31 18:01:25 507
转载 Ubuntu安装sun-jdk
From: http://blog.163.com/luowei505050@126/blog/static/11990720620132100511176/从http://www.oracle.com中下载jdk:jdk-6u38-linux-x64.bin,存放到/usr/java目录1、给权限:sudo chmod u+x/home/luowei/myapps/jdk-6u38-
2014-07-31 16:25:08 377
转载 Sun jdk、Openjdk、Icedtea jdk关系
From: http://59949.htmlfyxspgpw.blog.chinaunix.net/uid-20648944-id-3204527.htmln jdk与Openjdk版本发展历史如下图所示: 1、 Openjdk的前身是Sun公司的JDK虚拟机,最初Java标准是由Sun公司制定的,他们也开发出了严格遵循Java标准的Java虚拟机JDK,在当时JDK源代码
2014-07-31 16:25:02 1046
原创 poj-2828
// 14460K 3766MS G++#include #include #define MAX 200100struct TreeNode { int val; int l; int r; int insertPosNum;};typedef struct TreeNode TreeNode;TreeNode tree[MAX*4];
2014-07-31 15:00:31 459
转载 JNI中抛出异常
From: http://blog.csdn.net/sunnydogzhou/article/details/5564492应用场景:利用Java的JNI机制调用C写好的类库,现在需要在C的类库中抛出异常,然后在应用层即java上面捕获异常。 具体的实现形式如下首先定义一个异常类class NumberNotFounded extends Exception {
2014-07-31 13:45:47 683
转载 C/C++ 代码换行问题
From: http://blog.csdn.net/jj8582/article/details/6884736C/C++ 代码换行问题在写代码的时候遇到代码超长的情况下为了代码的美观及方便测试,故需要涉及到代码的换行问题,以下讨论了几种的情况:1、#define的宏 宏定义是以“\”换行,如:#define MAX(a,b) \ ((a)
2014-07-30 12:06:33 2473
转载 c/c++中的换行符“\” 宏定义\字符串 多行书写时换行
在代码中当一行的代码过多的时候,对于代码的阅读特别不方便,这时,需要使用换行符“\”。在使用换行符的时候要注意两点:1.c的编译器是根据“;”来判断是否为一个语句的,所以只要不在小括号中换行都是可以的。2.不要把空格夹在中间!
2014-07-30 12:03:47 14493
转载 android之Fragment(官网资料翻译)
Fragment要点Fragment作为Activity界面的一部分组成出现可以在一个Activity中同时出现多个Fragment,并且,一个Fragment亦可在多个Activity中使用。在Activity运行过程中,可以添加、移除或者替换Fragment(add()、remove()、replace())Fragment可以响应自己的输入事件,并且有自己的生命周期,当然,它们的
2014-07-29 17:38:16 436
转载 Linux之atime,mtime,ctime
首先可以使用stat 命令来查询文件的inode信息,其中包括ctime atime mtimeMtime:文件内容改变,ctime文件的状态改变,如chmod权限等。调整mtime,ctime会变。调整ctime,mtime不一定变化。 1.文件的容易理解:文件的 Access time,atime是在读取文件或者执行文件时更改的任何对inode的访问都会使此处改变。
2014-07-29 17:33:44 555
原创 poj-2528
// 20884K 297MS G++#include #include #include int posterNum;int ep[20010];unsigned short dis[10000010];int epNum;int cmp(const void * p1, const void * p2) { return (*((int*)p1)) - (
2014-07-29 17:13:37 507
转载 C/C++中关于qsort的使用
From: http://www.cnblogs.com/CCBB/archive/2010/01/15/1648827.htmlC/C++中有一个快速排序的标准库函数 qsort ,在stdlib.h 中声明,其原型为:void qsort(void *base, int nelem, unsigned int width, int ( * pfCompare)( con
2014-07-29 14:12:12 395
原创 poj-2352
// 668K 422MS G++#include #include const int MAX = 32767;const int LEVEL_MAX = 15100;int tree[MAX<<1];int levelNum[LEVEL_MAX];int starNum;void update(int curId, int x, int begin, int en
2014-07-28 15:36:19 444
原创 poj-1159
// 49424K 750MS G++#include #include using namespace std;#define MAX 5005short DP[MAX][MAX];// int DP[MAX];char str[MAX];int length;void solve() { memset(DP, 0xff, sizeof(DP)); for (in
2014-07-27 18:49:25 453
原创 poj-3176
// 1356K 32MS G++#include #include #define MAX 360long DP[MAX][MAX];long DP2[MAX];int cows[MAX][MAX];int rowNum;void solve() { memset(DP, 0, sizeof(DP)); memset(DP2, 0, sizeof(DP2)); f
2014-07-27 15:15:12 481
原创 poj-2533
// 360K 16MS G++#include #include #define MAX 1005int DP[MAX];int array[MAX];int num;void solve() { memset(DP, 0, sizeof(DP)); int maxLength = -1; for (int i = 0; i < num; i++) { if
2014-07-27 14:20:33 519
转载 国家集训队论文
国家集训队1999论文集陈宏:《数据结构的选择与算法效率——从IOI98试题PICTURE谈起》来煜坤:《把握本质,灵活运用——动态规划的深入探讨》齐鑫:《搜索方法中的剪枝优化》邵铮:《数学模型的建立、比较和应用》石润婷:《隐蔽化、多维化、开放化——论当今信息学竞赛中数学建模的灵活性》杨帆:《准确性、全面性、美观性——测试数据设计中的三要素》周咏基:《论随机化算法的
2014-07-27 10:23:54 1017
转载 Note: log switch off, only log_main and log_events will have logs!
Note: log switch off, only log_main and log_events will have logs!
2014-07-25 18:07:53 4846
原创 poj-1836
//380K 79MS G++#include #include using namespace std;double soldiers[1005];struct soldierInfo{ double prevHeight; int num;};typedef struct soldierInfo soldierInfo;soldierInfo a
2014-07-25 17:16:43 470
原创 poj-3267
#include #include #include #include using namespace std;int DP[305][305]; //int DP2[305];string dict[605];int W; // num of dictint L; // length of messagestring message;#define INF 99
2014-07-24 19:34:30 382
原创 poj-1837
// 1644K 16MS G++#include #include #include using namespace std;#define MAX_W 25#define MAX_W_NUM 20#define MAX_L 15#define MAX MAX_W*MAX_L*MAX_W_NUM#define MAXLENGTH MAX*2 + 1#def
2014-07-24 10:26:46 507
转载 【算法】Dancing Links (DLX) II
From: http://blog.csdn.net/keyboardlabourer/article/details/131683911. 数独问题在前一篇中简要地介绍了DLX算法,这一篇将主要讲DLX的应用——解决数独问题。DLX本身是用来解决exact cover问题,如果有一些问题能转化成exact cover问题,也就意味着也能用DLX求解。数独(Su
2014-07-23 15:44:35 516
转载 【算法】Dancing Links (DLX) I
From: 1.概述Dacing Links (DLX) 算法是Donald Knuth [2]提出,用以解决精确覆盖(exact cover)问题,是X算法在计算机上的优化。1.1 精确覆盖问题所谓精确覆盖,是指两两不相交的子集的集合,这些子集的并集可以得到全集。完整的定义 [1]如下:在一个全集X中若干子集的集合为S,精确覆盖是指,S的子集S*,
2014-07-23 15:40:31 1043
原创 poj-2676
// 356K 16MS G++#include #include #include #define MAX 9using namespace std;char initBoard[MAX][MAX];int initFIlledNum;void printBoard(char board[MAX][MAX]) { for (int i = 0; i < M
2014-07-23 15:27:22 557
原创 poj-1416
// 1612K 16MS G++#include #include #include #include #include using namespace std;int targetNum;int inputNum;string inputNumStr;struct BFSNode { int splitterPos; // x means ins
2014-07-23 11:43:15 592
转载 C++空类默认函数
From: http://blog.sina.com.cn/s/blog_5f76aaf20100cwlj.html定义一个空的C++类,例如class Empty{}一个空的class在C++编译器处理过后就不再为空,编译器会自动地为我们声明一些memberfunction,一般编译过去就相当于class Empty{public:Empty(); //
2014-07-23 09:30:04 876
原创 poj-2531
// 3916K 375MS G++#include #include using namespace std; #define MAX 22 int NodeBitId[MAX]; int G[MAX][MAX]; #define INF 99999; long MAXT; void initNodeBit
2014-07-22 20:20:22 349
原创 poj-3414
//596K 32MS G++ #include #include #include #define MAX 102using namespace std;const char OP[6][10] = { "FILL(1)", "FILL(2)", "DROP(1)", "DROP(2)", "POUR(1,2)", "POUR(2,1)"
2014-07-22 16:25:37 454
原创 poj-3087
//716K 0MS G++#include #include #include #include using namespace std;map stackMap;int stackLength;string S1;string S2;string S12;string res;void interleave() { S12 = ""; for
2014-07-22 15:15:11 463
原创 poj-3126
// 600K 16MS G++#include #include #include #include using namespace std;char compositeNum[10000];char BFSFlag[10000];void getPrime() { int max = 100; int begin = 2; while(be
2014-07-22 12:15:11 477
转载 Python中的除法
From: http://blog.csdn.net/sicofield/article/details/8613877在C语言对于整形数执行除法会进行地板除(舍去小数部分)。例如 int a=15/10; a的结果为1。Python中分为3种除法:传统除法、精确除法、地板除。传统除法如果是整数除法则执行地板除,如果是浮点数除法则执行精确除法。
2014-07-21 21:03:34 614
转载 Python的浮点数损失精度问题(为什么说双精度浮点数有15位十进制精度)
本篇讨论的现象可以从下面这段脚本体现出来:>>> x = 0.0>>> for i in range(10): x += 0.1 print(x) 0.10.20.300000000000000040.40.50.60.70.79999999999999990.89999999999999990.9999999999999999>>>即:为什么有几行的输
2014-07-21 21:00:03 14135 1
转载 printf格式输出数字,位数不够前面补0,适用与输出编号
From: http://blog.chinaunix.net/uid-26295753-id-2981750.htmlprintf格式输出:%[flags][width][.perc][F|N|h|l]type用到了flags中的 0 (注意是零不是欧) ,其百科描述为:将输出的前面补上0,直到占满指定列宽为止(不可以搭配使用-)width 即表示需要输出的位数。in
2014-07-21 20:57:33 52943 3
原创 poj-1426
#include #include #include #include using namespace std;#define MAX1 45#define MAX_R 100000struct BFSNode{ int digitCapacity; int reminderArraySize; int reminderArray[MAX1]; //
2014-07-21 20:54:23 453
转载 android 使用include 调用内部组件
http://androidbiancheng.blogspot.com/2011/01/includeui.html折腾了一晚上,搞明白了include 调用组件问题。例子一:sublayout.xml android:orientation="vertical" android:layout_width="fill_parent"
2014-07-21 14:50:17 1413
转载 经典的java中return和finally问题!
前一段时间参加公司的笔试问了这个问题,回来一查才知道当时自己做错了,百思不得其解,上网查到下面的程序,但是运行后发现了错误,我修改后放在了我的blog上面,希望和大家分享。经典的java中return和finally问题! 代码如下:public class Test{ public static void main
2014-07-21 14:09:15 509
原创 poj-3278
// 1152K 47MS G++#include #include #include #define MAX 100001using namespace std;struct Pos { int x; int time;};typedef struct Pos Pos;queue BFSQueue;int Bx;int Ex;in
2014-07-21 13:21:56 534
转载 android 中Xml里面的id重名问题
From: http://blog.csdn.net/luckyjda/article/details/8548127今天在做项目的时候,居然发现@+id 居然可以重名,而且程序还不会报错。郁闷了,这到底怎么回事呢?经过google 和百度之后,才有所了解。情况一:同个一个Xml文件中的同名在同个一个Xml文件的中若同名了,则前一个有效,而后一个无效,即后一个Null掉。如:
2014-07-21 11:40:30 682
原创 poj-2251
//788K 0MS G++#include #include #include #define MAX 50using namespace std;char maze[MAX][MAX][MAX]; // z , y, xstruct Pos { int x; int y; int z; int time;};typedef struc
2014-07-21 11:16:40 446
原创 poj-1321
// 376K 16MS G++#include #include #define MAX 10char occupiedColumn[MAX];char occupiedRow[MAX];char board[MAX][MAX];int W;int H;int chessNum;#define INF 99999int dfs(int rowId, int
2014-07-21 10:24:04 483
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人