1、POJ 2718 Smallest Difference(穷竭搜索,枚举) 题意:给出0~9之间的几个数,从给出的数中组合成两个新的整数(首位不为0),求两个数之间的差的绝对值的最小值。 思路:由于最多只有10个数,全排列枚举,前n/2个形成一个数,后面的数字形成另一个数。 1 #include ...
分类:
其他好文 时间:
2017-07-09 12:43:05
阅读次数:
246
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1135 代码 // the smallest primitive root of prime P #include <bits/stdc++.h> const long lo ...
分类:
其他好文 时间:
2017-07-01 23:25:33
阅读次数:
273
https://leetcode.com/problems/kth-smallest-element-in-a-bst/#/solutions 递归: ...
分类:
其他好文 时间:
2017-06-30 17:18:37
阅读次数:
126
Given a positive integer a, find the smallest positive integer b whose multiplication of each digit equals to a. If there is no answer or the answer i ...
分类:
其他好文 时间:
2017-06-25 10:01:45
阅读次数:
196
https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix/#/solutions http://www.cnblogs.com/EdwardLiu/p/6109080.html Solution 2 : Binary ...
分类:
其他好文 时间:
2017-06-22 00:16:28
阅读次数:
131
625. Minimum FactorizationGiven a positive integer a, find the smallest positive integer b whose multiplication of each digit equals to a. If there is ...
分类:
其他好文 时间:
2017-06-20 01:03:45
阅读次数:
303
Given a positive integer a, find the smallest positive integer b whose multiplication of each digit equals to a. If there is no answer or the answer i ...
分类:
其他好文 时间:
2017-06-18 14:20:38
阅读次数:
193
k-th divisor You are given two integers n and k. Find k-th smallest divisor of n, or report that it doesn't exist. Divisor of n is any such natural nu ...
分类:
其他好文 时间:
2017-06-18 13:15:19
阅读次数:
212
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ? k ? BST's ...
分类:
其他好文 时间:
2017-06-12 00:42:23
阅读次数:
175
The Company Dynamic Rankings has developed a new kind of computer that is no longer satisfied with the query like to simply find the k-th smallest num ...
分类:
其他好文 时间:
2017-06-10 21:29:19
阅读次数:
179