`
bcyy
  • 浏览: 1816316 次
文章分类
社区版块
存档分类
最新评论
文章列表
Simon and Antisimon play a game. Initially each player receives one fixed positive integer that doesn't change throughout the game. Simon receives numberaand Antisimon receives numberb. They also have a heap ofnstones. The players take turns to make a move and Simon starts. During a move a ...
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 calculate the sum. To make the calculation easier, the sum only contains numbers 1, 2 a ...
原题链接:http://oj.leetcode.com/problems/unique-binary-search-trees/这道题要求可行的二叉查找树的数量,其实二叉查找树可以任意取根,只要满足中序遍历有序的要求就可以。从处理子问题的角度来看,选取一个结点为根,就把结点切成左右子树,以这个结点为根的可行二叉树数量就是左右子树可行二叉树数量的乘积,所以总的数量是将以所有结点为根的可行结果累加起来。写成表达式如下: 熟悉
原题链接:http://oj.leetcode.com/problems/unique-binary-search-trees-ii/这道题是求解所有可行的二叉查找树,从Unique Binary Search Trees中我们已经知道,可行的二叉查找树的数量是相应的卡特兰数,不是一个多项式时间的数量级,所以我们要求 ...
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.rows;i++){ uchar* img_p = img.ptr<uchar>(i); float* img_f = filtered_img.ptr& ...
题目很奇怪,就是5个人排队喝可乐,喝完之后编程两个人,然后拍在队后面,然后继续喝可乐。 给出个数值,代表第几罐可乐,问会是第几个人喝到? http://codeforces.com/problemset/problem/82/A 一个数学问题,仔细点就好了。 要熟练的知识点: 1 要熟悉解决这种递增数列,如何减去循环部分 2 要知道如何计算,求余取答案 #include <string> #include <iostream> using namespace std; void DoubleCola() { string strs[] = {& ...
Many of SKB Kontur programmers like to get to work by Metro because the main office is situated quite close the station Uralmash. So, since a sedentary life requires active exercises off-duty, many of the staff — Nikifor among them — walk from their homes to Metro stations on foot. Ni ...
Mrs Little likes digits most of all. Every year she tries to make the best number of the year. She tries to become more and more intelligent and every year studies a new digit. And the number she makes is written in numeric system which base equals to her age. To make her life more beautiful sh ...
At the start of each school year, a very important event happens at Hogwarts. Each of the first-year wizards and witches is assigned to one of the four Hogwarts houses. The bravest children are put to Gryffindor, the cleverest are put to Ravenclaw, the most hard-working go to Hufflepuff, and Sl ...
The language of Australian aborigines anindilyakwa has no numerals. No anindilyakwa can say: “I've hooked eight fishes”. Instead, he says: “I've hooked as many fishes as many stones are in this pile”. Professor Brian Butterworth found a meadow with three piles of stones. He decided to de ...
原题链接:http://oj.leetcode.com/problems/restore-ip-addresses/这道题的解法非常接近于NP问题,也是采用递归的解法。基本思路就是取出一个合法的数字,作为IP地址的一项,然后递归处理剩下的项。可以想象出一颗树,每个结点有三个可能的分支(因为范围是0-255,所以可以由一位两位或者三位组成)。并且这里树的层数不会超过四层,因为IP地址由四段组成,到了之后我们就没必要再递归下去,可以结束了。这里除了上述的结束条件外,另一个就是字符串读完了。可以看出这棵树的规模是固定的,不会像平常的
原题链接:http://oj.leetcode.com/problems/interleaving-string/这是一道关于字符串操作的题目,要求是判断一个字符串能不能由两个字符串按照他们自己的顺序,每次挑取两个串中的一个字符来构造出来。像这种判断能否按照某种规则来完 ...
Ten big walnuts is a whole lot of walnuts, that's for sure! Two walnuts is too little for anybody. How about six walnuts? Is it a small number of walnuts or a large one? The Parrot has already found an answer to this question: after eating a small amount of walnuts he wants to eat some more, wh ...
A New Russian Kolyan likes two things: money and order. Kolyan has lots of money, but there is no order in it. One beautiful morning Kolyan understood that he couldn't stand this any longer and decided to establish order in his money. He told his faithful mates to fetch the money from an underg ...
Our chemical biologists have invented a new very useful form of life calledstripies(in fact, they were first called in Russian -polosatiki, but the scientists had to invent an English name to apply for an international patent). The stripies are transparent amorphous amebiform creatures that live ...
Global site tag (gtag.js) - Google Analytics