For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient.Input Spe...
分类:
其他好文 时间:
2015-09-08 12:32:02
阅读次数:
154
【HDOJ 4763】 Theme Section
Theme Section
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1999 Accepted Submission(s): 947
P...
分类:
其他好文 时间:
2015-09-07 22:54:51
阅读次数:
215
Problem:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not...
分类:
其他好文 时间:
2015-09-07 07:01:04
阅读次数:
214
Red-Black trees are notorious for being nightmares of pointer manipulation. Instructors will show the theory, but won’t torture their students to impl...
分类:
其他好文 时间:
2015-09-06 16:24:42
阅读次数:
180
1088. Rational Arithmetic (20)时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueFor two rational numbers, your task is to implement the basic ...
分类:
其他好文 时间:
2015-09-06 15:59:08
阅读次数:
152
strstr函数:返回主串中子字符串的位置后的所有字符。#include const char *my_strstr(const char *str, const char *sub_str){ for(int i = 0; str[i] != '\0'; i++) { i...
分类:
其他好文 时间:
2015-09-05 19:19:33
阅读次数:
117
Problem:Implement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more of the preceding ele...
分类:
其他好文 时间:
2015-09-05 12:25:23
阅读次数:
148
1)众所周知,抽象类是不存在对象的,只提供接口而不提供实现。但是抽象类能不能作为一个类指针,指向其子类的对象呢?class Interface { public: virtual void fun() = 0;};class Implement: public Interface {pu...
分类:
编程语言 时间:
2015-09-04 21:06:36
阅读次数:
163
Implement int sqrt(int x).Compute and return the square root of x.依然二分法….这道题虽然简单,但是有一些细节需要注意,我是提交了好几遍才通过的!参考代码:class Solution
{
public:
int mySqrt(int x)
{
if (x < 2) return x;...
分类:
其他好文 时间:
2015-09-04 14:24:27
阅读次数:
149
Implement pow(x, n).实现乘幂运算,给出的提示是Bianry Search。其实就是利用公式xn=xn/2?xn/2?xn%2x^n = x^{n/2} * x^{n/2} * x^{n\%2}进行运算。参考代码:class Solution
{
private:
double power(double x, int n)
{
if (0...
分类:
其他好文 时间:
2015-09-04 14:23:19
阅读次数:
137