题目:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a sin....
分类:
编程语言 时间:
2014-07-24 10:01:23
阅读次数:
223
Maximum Sum大意:给你一个n*n的矩阵,求最大的子矩阵的和是多少。思路:最开始我想的是预处理矩阵,遍历子矩阵的端点,发现复杂度是O(n^4),就不知道该怎么办了。问了一下,是压缩矩阵,转换成最大字段和的问题。压缩行或者列都是可以的。 1 int n, m, x, y, T, t; 2 in...
分类:
其他好文 时间:
2014-07-24 07:10:58
阅读次数:
211
数学题。f(n) = 2^(n-1) mod (1e9+7)。 1 #include 2 3 #define MAXN 100005 4 5 char buf[MAXN]; 6 __int64 phi = 1e9+6; 7 __int64 mod = 1e9+7; 8 9 __int64 p...
分类:
其他好文 时间:
2014-07-24 05:00:38
阅读次数:
237
Gray CodeThe gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the tot...
分类:
其他好文 时间:
2014-07-24 00:53:27
阅读次数:
198
# include
# include
# include
using namespace std;
int father[1010];
int next[1010];//当前集合的下个元素(包括i)
int pre[1010];//当前集合的上个元素(包括i)
int num[1010];//num[i]当前集合储存的点的个数(包括i)
int vis[1010];
int sum[101...
分类:
其他好文 时间:
2014-07-23 22:39:47
阅读次数:
446
Lowbit SumTime Limit:2000/1000MS (Java/Others)Memory Limit:128000/64000KB (Java/Others)SubmitStatusProblem Descriptionlong long ans = 0;for(int i = 1;...
分类:
其他好文 时间:
2014-07-23 22:22:27
阅读次数:
506
1.hashMap方法O(n)空间换时间public class Solution { public int[] twoSum(int[] numbers, int target) { HashMap hash=new HashMap(); int ans[]=ne...
分类:
其他好文 时间:
2014-07-23 22:20:57
阅读次数:
262
最近两天在写搜索专题题意:中文题就不用讲题意思路:由于每行每列只允许最多一个棋子,那么我们可以从第一行开始往下搜索,并标记列,如果这列放了就不放,否则就放,并向下层搜索,这样可以不用标记行了。#include#includeint n,sum,m;const int maxn = 10;char m...
分类:
其他好文 时间:
2014-07-23 22:16:37
阅读次数:
264
prim算法模板int prim(int x){ int i,j,sum=0,min=M,k; memset(vit,0,sizeof(vit)); memset(dis,0,sizeof(dis)); for(i=1;ip[k][j]) dis[j]=p[k][j]; } } } return ....
分类:
其他好文 时间:
2014-07-23 22:10:17
阅读次数:
205
#Red hat enterprise linux variants ##Two install sets available ##两种安装方案 ###Server rhel server rhea advanced platform ###Desktop rhel desktop workstation option Multi-OS option ##RH network #...
分类:
Web程序 时间:
2014-07-23 21:33:26
阅读次数:
283