网址:chanllenge修改url最后的html的前缀为答案,就可以过关。然后推荐一个在线代码运行的网站 ideone第一题:题目:要求取2的38次方。解:python支持**符号表示指数,也可以用match.pow()2 ** 38math.pow(2, 38)第二题:题目:字符变换,最简单的加...
分类:
编程语言 时间:
2014-08-29 15:59:38
阅读次数:
220
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the valu...
分类:
其他好文 时间:
2014-08-27 21:50:28
阅读次数:
210
Implement pow( x, n ).思路:利用位运算来求解:当n为正时,其不同位取1,对应乘上x的不同次幂。从低位往高位,按2倍关系增长。该解法需要注意:当n取INT_MIN时,其负值为原值,需要特殊考虑。貌似此处不需要考虑double溢出的情况。另外,网上还有二分递归调用的解法。 1 cl...
分类:
其他好文 时间:
2014-08-27 12:48:17
阅读次数:
186
String to Integer (atoi)
Total Accepted: 15482 Total
Submissions: 106043My Submissions
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases...
分类:
其他好文 时间:
2014-08-27 01:40:07
阅读次数:
293
重启命令:1、reboot2、shutdown -r now立刻重启3、shutdown -r*过*分钟自动重启4、shutdown -r 20:35在时间为20:35时候重启如果是通过shutdown命令设置重启的话,可以用shutdown -c命令取消重启关机命令:1、halt立刻关机2、pow...
分类:
系统相关 时间:
2014-08-26 22:54:07
阅读次数:
277
Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element....
分类:
其他好文 时间:
2014-08-26 22:52:26
阅读次数:
203
#include<iostream>
#include<cmath>
usingnamespacestd;
intmain()
{
intn;
charans;
doublepi;
//for(intn=0;n<=20;n++)
//{
do{
cout<<"输入n求pi的近似值:\n";
cin>>n;
pi=0.0;
for(inti=0;i<=n;i++)
{
pi+=1.0*pow(-1,i)/(2*i+1);
}
..
分类:
其他好文 时间:
2014-08-25 17:20:14
阅读次数:
198
Implement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The...
分类:
其他好文 时间:
2014-08-25 16:20:54
阅读次数:
161
Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.class Solution {public: ...
分类:
其他好文 时间:
2014-08-25 13:11:34
阅读次数:
153
题意:给出一个数让你求出等于这个数的x
策略:如题。因为整个式子是单调递增的,所以可以用二分。
要注意到精度.
代码:
#include
#include
#include
#define eps 1e-10
#define f(x) 8*pow(x, 4) + 7*pow(x, 3) + 2*pow(x, 2) + 3*x
int main()
{
int t;
double...
分类:
其他好文 时间:
2014-08-25 08:46:34
阅读次数:
209