- 博客(37)
- 资源 (1)
- 收藏
- 关注
原创 Hiho1507 : 可疑的记录
可疑的记录 描述 小Hi有一棵N个节点的树,编号1-N,其中1号节点是整棵树的根。他把这棵树的N-1条边记录成N-1行,每行2个整数a和b,表示a是b的父节点。 喜欢恶作剧的小Ho在小Hi的记录里加了一行两个整数,于是小Hi不得设法找出这行可疑的记录。具体来说,如果去掉某一行之后,余下N-1行按小Hi的规则(a是b的父节点)恰好能构成一棵N个节点的树,并且满足编号恰好是1-N
2017-04-18 16:02:31
363
原创 hiho1505 : 小Hi和小Ho的礼物描述
小Hi和小Ho的礼物 描述 某人有N袋金币,其中第i袋内金币的数量是Ai。现在他决定选出2袋金币送给小Hi,再选2袋金币送给小Ho,同时使得小Hi和小Ho得到的金币总数相等。他想知道一共有多少种不同的选择方法。 具体来说,有多少种下标四元组(i, j, p, q)满足i, j, p, q两两不同,并且i i + Aj = Ap + Aq。 例如对于数组A=[1, 1, 2,
2017-04-18 15:51:04
1160
原创 【LeetCode】17. Letter Combinations of a Phone Number
Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Inpu
2017-03-20 22:32:58
348
原创 【LeetCode】11. Container With Most Water
Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of lineiis at (i,ai) and (i, 0). Find two lines, wh
2017-03-19 00:17:52
245
原创 【LeetCode】8. String to Integer (atoi)
Implement atoi to convert a string to an integer. Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input c
2017-03-17 23:35:31
312
原创 stream&对象到bool的转换小结(C++11的safe-bool)
在我们日常使用C++的各种场景中,通过while(cin>>num),while(getline(cin,str))这种来判断输入是很常见的。那么这种istream对象到bool的转换具体是怎么实现的呢。 1.旧版实现 这里会不会是直接在istream类中直接定义bool的类型转换呢——形如operator bool (){ }; 很遗憾,并没有这么简单。因为我们知道,bool型
2017-03-17 21:58:15
1148
原创 【LeetCode】4 Median of Two Sorted Arrays
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 =
2017-03-16 22:44:35
221
原创 【LeetCode】6. ZigZag Conversion
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I
2017-03-16 21:54:04
215
原创 超级素数幂
链接:https://www.nowcoder.com/questionTerminal/fb511c3f1ac447309368d7e5432c6c79 来源:牛客网 如果一个数字能表示为p^q(^表示幂运算)且p为一个素数,q为大于1的正整数就称这个数叫做超级素数幂。现在给出一个正整数n,如果n是一个超级素数幂需要找出对应的p,q。 输入描述: 输入一个正整数n(2 ≤ n ≤
2017-03-07 22:41:23
965
原创 【LeetCode】leetcode sum问题汇总小结
1. 2Sum Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution. Example: G
2017-01-05 23:47:42
316
原创 http发post请求 返回错误500a
POST /DataProcess/DataCommunicate HTTP/1.1 Host: 10.12.43.122:8080 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Content-Length: 55 Content-Type: application/x
2016-12-03 14:02:19
3341
原创 1119. Pre- and Post-order Traversals (30)
Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder traversal sequences, or preorder and inorder
2016-12-02 11:34:18
277
原创 1118. Birds in Forest (25)
Some scientists took pictures of thousands of birds in a forest. Assume that all the birds appear in the same picture belong to the same tree. You are supposed to help the scientists to count the maxi
2016-12-02 11:24:33
256
原创 1117. Eddington Number(25)
British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, he has even defined an "Eddington number", E -- that is, the maximum integer E such that it is for E
2016-12-02 11:13:47
229
原创 1116. Come on! Let's C (20)
"Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang University. Since the idea of the contest is for fun, the award rules are funny as
2016-12-02 10:47:03
378
原创 1020. Tree Traversals (25)
Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of the cor
2016-11-28 22:10:03
274
原创 1021. Deepest Root (25)
A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a highest tree. Such a root
2016-11-28 21:28:18
222
原创 1016. Phone Bills (25)
A long-distance telephone company charges its customers by the following rules: Making a long-distance call costs a certain amount per minute, depending on the time of day when the call is made. Wh
2016-11-17 22:16:02
437
原创 1014. Waiting in Line (30)
Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are: The s
2016-11-17 15:51:12
215
原创 1012. The Best Rank (25)
To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algebra), and E - Eng
2016-11-16 15:24:52
214
原创 1013. Battle Over Cities (25)
It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We must know immediately if we nee
2016-11-16 15:23:13
203
原创 1011. World Cup Betting (20)
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Si
2016-10-27 23:06:09
238
原创 1010. Radix (25)
Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is "yes", if 6 is a decimal number and 110 is a binary number. Now for any pair of positive
2016-10-27 22:48:29
209
原创 1009. Product of Polynomials (25)
This time, you are supposed to find A*B where A and B are two polynomials. Input Specification: Each input file contains one test case. Each case occupies 2 lines, and each line contains the inf
2016-10-27 22:39:21
191
原创 1008. Elevator (20)
The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 sec
2016-10-16 23:07:11
214
原创 1087. All Roads Lead to Rome (30)
Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most happiness. Input Specification: E
2016-10-03 23:44:39
341
原创 1018. Public Bike Management (30)
There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and return it to any other stations in the
2016-10-02 13:16:47
231
原创 a1007 . Maximum Subsequence Sum (25)
Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1 Maximum Subsequence is the continuous subsequence which has the largest su
2016-09-23 22:48:34
253
原创 a1005. Spell It Right (20)
Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English. Input Specification: Each input file contains one test case.
2016-03-28 20:24:41
264
原创 a1003. Emergency (25)
As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each city and the l
2016-03-25 10:58:50
254
原创 a1006. Sign In and Sign Out (25)
At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in's and out's, you
2016-03-24 11:41:39
254
原创 a1004. Counting Leaves (30)
A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input Each input file contains one test case. Each case starts with
2016-03-21 20:55:17
302
原创 a1002. A+B for Polynomials (25)
This time, you are supposed to find A+B where A and B are two polynomials. Input Each input file contains one test case. Each case occupies 2 lines, and each line contains the information of a p
2016-03-18 18:01:50
299
原创 a1001. A+B Format (20)
1001. A+B Format (20) Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).
2016-03-18 15:45:29
306
原创 opencv 3加opencv_contrib配置
今天搞了一天,截止目前十一点还是没搞好。 http://www.cnblogs.com/Geo-fortune/p/4822997.html 具体参照上面这位的教程,一开始没想到中文搜关键字,对着contrib的readme文件折腾了一会,后来果断谷歌搜到了不少同一版本的教程,上面链接就是其一。 按着步骤来,cmake添加OPENCVEXTRAMODULESPAT
2015-11-17 23:02:08
404
原创 OpenCv学习之 addWeighted
addWeighted 函数中两个合并的对象需大小一致,并且多通道的图像和单通道的不能合并,这时可以将双通道imread时加上参数0;
2015-11-03 10:20:06
420
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅