Xenia the beginner mathematician is a third year student at elementary school. She is now learning the addition operation.
The teacher has written down the sum of multiple numbers. Pupils should ca...
分类:
其他好文 时间:
2014-07-22 23:05:53
阅读次数:
382
题目链接:1484 - Alice and Bob's Trip
题意:BOB和ALICE这对狗男女在一颗树上走,BOB先走,BOB要尽量使得总路径权和大,ALICE要小,但是有个条件,就是路径权值总和必须在[L,R]之间,求最终这条路径的权值。
思路:树形dp,dp[u]表示在u结点的权值,往下dfs的时候顺带记录下到根节点的权值总和,然后如果dp[v] + w + sum 在[l,r]内,...
分类:
其他好文 时间:
2014-07-22 23:05:33
阅读次数:
486
题目链接:
http://poj.org/problem?id=1707
Language:
Default
Sum of powers
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 735
Accepted: 354
D...
分类:
其他好文 时间:
2014-05-01 18:36:32
阅读次数:
385
Gabor的核函数参考的wiki使用实数Real的公式计算核函数代码:Mat gaborFilter(Mat& img, Mat& filter){
int half_filter_size = (max(filter.rows,filter.cols)-1)/2;
Mat filtered_img(img.rows,img.cols,CV_32F);
for(int i=0;i<img.r...
分类:
其他好文 时间:
2014-05-01 17:42:41
阅读次数:
378
我采用Database First,用Sql很容易就可以做到对一个表进行压缩。如以下:
CREATE TABLE [dbo].[Entities](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](max) NULL,
Primary Key Clustered ([Id] ASC) WITH (DATA_...
分类:
数据库 时间:
2014-04-30 22:23:39
阅读次数:
436
Max Sum
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 135262 Accepted Submission(s): 31311
Problem Description
Given a sequen...
分类:
其他好文 时间:
2014-04-30 22:21:40
阅读次数:
280
大数乘法的步骤(先戳我看看大数加法的思想):
首先是输入2个数据,并且逆序,还要去掉前导0。比较大小:
相等的话,结果为0。前者大于后者,则直接进行减法运算。前者小于后者,则用后者减去前者,最后在结果前面添上负号。
从最高位开始输出结果。
#include
#include
#define MAX 1000
using namespace std;
void InputNu...
分类:
其他好文 时间:
2014-04-30 22:17:40
阅读次数:
231
最长上升子序列:
有两种基本方法:两个时间复杂度分别为O(n^2)和O(nlogn)。
O(n^2)
容易的出动态规划的递推公式dp[i]=max(dp[j])+1 j=1,2...i-1,dp[i]是以元素i结尾的最长子序列个数。
在O(n^2)的最长上升子序列中可以通过记录每个元素前缀元素位置的方式来得到整个的最长上升子序列。
代码:int LISOn2(int a[],int to...
分类:
其他好文 时间:
2014-04-29 13:24:22
阅读次数:
314
JS 对某图片的等比缩放
代码
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
最新javascript自动按比例显示图片,按比例压缩图片显示
function AutoResizeImage(maxWidth,max...
分类:
数据库 时间:
2014-04-29 13:14:22
阅读次数:
440
Given two binary strings, return their sum (also a binary string).
For example,
a = "11"
b = "1"
Return "100".
思路同十进制的大数相加。代码如下:
class Solution {
public:
string addBinary(string a, str...
分类:
其他好文 时间:
2014-04-29 13:12:20
阅读次数:
328