快速幂;
#include
#include
#include
#include
int prime(const int p)
{
for(int i=3; i*i<=p; i++)
if(p%i==0)
return 0;
return 1;
}
int power(const int a,const int p)
{
long ...
分类:
其他好文 时间:
2014-11-19 11:18:27
阅读次数:
189
Implement pow(x, n).
原题链接:https://oj.leetcode.com/problems/powx-n/
public double pow(double x, int n) {
if(n== 0)
return 1;
if(n == 1)
return x;
if(n % 2 ==0)
return pow(x*x,n/2);
...
分类:
其他好文 时间:
2014-11-19 11:19:53
阅读次数:
135
问题描述:
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Dete...
分类:
其他好文 时间:
2014-11-19 11:16:51
阅读次数:
145
总结软件开发方法与开发模型,分析它们之间的区别。。...
分类:
其他好文 时间:
2014-11-19 11:16:45
阅读次数:
162
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/41257397
今天OJ可好几次,发现总是出错,最后才发现是自己把题目理解错了,想想就觉得好笑。
题目的意思是给定一个整数n,让你求出按照上面规律在执行若干次后所得到的串,其实该算法主要用到递归的思想。
我却把题目意思错误地理解为:对于给定的整数n,对该整数n执行N次上述递归操作后得到的串。例如给定2,得到的结果是1112。
当我将给定整数设定为1000时,果断出现内...
分类:
其他好文 时间:
2014-11-19 11:18:20
阅读次数:
217
Jeff Lee blog: http://www.cnblogs.com/Alandre/
(泥沙砖瓦浆木匠),retain the url when reproduced ! Thanks
今天我们来Android UI第二讲:实现DridView的菜单样式
下载链接:
http://files.cnblogs.com/Alandre/AndroidUI2.rar
效果图:
...
分类:
其他好文 时间:
2014-11-19 11:15:16
阅读次数:
252
首先需要声明一下实例变量和属性的区别。
实例变量:
/// 接口文件
#import
- (int) a; // 实例变量
- (int) b;
- (void) fun1;
...
@end
/// 实现文件
#import "XXX.h"
@implementation XXX
{
int a;
// 实例变量
int b;
}
...
分类:
其他好文 时间:
2014-11-19 11:15:41
阅读次数:
181
UVA 145 模拟题...
分类:
其他好文 时间:
2014-11-19 11:14:58
阅读次数:
112
Fibonacci Tree
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2340 Accepted Submission(s): 748
Problem Description
Coach Pang...
分类:
其他好文 时间:
2014-11-19 11:16:55
阅读次数:
166
【扩展知识二】学习一些重要的知识
【扩展目录】
1. 布尔型,浮点型、指针的变量与0值得比较
2. 类型转换
3. 关键字sizeof和strlen()函数
A:bool变量与0值得比较
布尔型,用于表示布尔值,即逻辑值TRUE(真)和FALSE (假)。在C语言中非零即为真,零就为假。
较合理的写法是:
//测试环境...
分类:
其他好文 时间:
2014-11-19 11:13:48
阅读次数:
207
第一个位置有3种,后i-1个位置每个都是2选1,有2^(i-1),总数为3*2^(i-1);
第一个和最后一个不能相同,减去f[n-1]乘以最后插一个相同的情况,即f[n-1];
#include
#include
#include
#include
int main(void)
{
int n;
double f[51];
f[1]=3;
f[2]=6;...
分类:
其他好文 时间:
2014-11-19 11:15:45
阅读次数:
184
How to manually remove an infected file from your computer
In order to manually remove an infected item from your computer you need to perform the following steps:
1. Restart the computer in Safe...
分类:
其他好文 时间:
2014-11-19 11:15:22
阅读次数:
162
题意:
求定义y(x)=4*x-1
给L、R求 fib(y(L))~fib(y(R))的和
思路:
和之前做的一道题类似。
定于Fib为
1 1
1 0
我们的第一项就是x=1时的 就是Fib^3
然后下一项其实就是fib(3+4)=Fib^3*Fib^4
所以递推矩阵就是Fib^4
然后求和利用快速的求法
设
Fib E
0 E
这样运算N次右上角的矩阵就是我...
分类:
其他好文 时间:
2014-11-19 11:14:19
阅读次数:
197
OpenStack和VNC
Openstack默认安装的访问控制台基于VNC的,我们从Horizon进入主机实例的控制台,就是noVNC,我在之前的一篇文章里专门对noVNC也做过测试(http://blog.csdn.net/chao_beyond/article/details/24922397)。这里不讨论noVNC的原理,主要罗列下我在使用Openstack过程当中,关于VNC的几点记录...
分类:
其他好文 时间:
2014-11-19 11:12:31
阅读次数:
516
nginx出于性能考虑采用类似lib_event的方式,自己对时间进行了cache,用来减少对gettimeofday()的调用,因为一般来说服务器对时间的精度要求不是特别的高,不过如果需要比较精确的timer,nginx还提供了一个timer_resolution指令用来设置时间精度,具体的机制再后面会做介绍。在ngx_times.c中提供了ngx_time_update()函数来更新时间缓存,...
分类:
其他好文 时间:
2014-11-19 11:12:33
阅读次数:
126
Holding Bin-Laden Captive!
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 15501 Accepted Submission(s): 6951
Problem Description
...
分类:
其他好文 时间:
2014-11-19 11:12:19
阅读次数:
151
Description
Good news for us: to release the financial pressure, the government started selling galaxies and we can buy them from now on! The first one who bought a galaxy was Tianming Yun and he g...
分类:
其他好文 时间:
2014-11-19 11:11:04
阅读次数:
134