思路:m和n如果有公约数,则安全洞存在,无公约数或公约数为1,则无
#include
int gcd(int a,int b)
{
if(b==0)return a;
else
{
int r;
while(b!=0)
{
r=a%b;
a=b;
...
分类:
其他好文 时间:
2014-05-07 02:54:02
阅读次数:
283
首先说明下,下面两种方法均可以获得手机的mac地址,但是有个限制,是在iOS一下才可以获得。iOS7以后苹果对于sysctl和ioctl进行了技术处理,MAC地址返回的都是02:00:00:00:00:00。官方文档上这样写的“Twolow-level networking APIs that used to return a MAC address now return thefixed
v...
分类:
移动开发 时间:
2014-05-07 02:49:17
阅读次数:
612
题目:
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.
Return a deep copy of the list.
思路:
主要是深层复制的问题:
本题比较简...
分类:
其他好文 时间:
2014-05-07 02:44:38
阅读次数:
344
#include string num2str( int i){ stringstream ss;
ss<<i; return ss.strs();}
分类:
编程语言 时间:
2014-05-07 02:17:33
阅读次数:
268
一,带函数Pred 1, all(Pred, List) ->
boolean()如果List中的每个元素作为Pred函数的参数执行,结果都返回true,那么all函数返回true,
否则返回false例子:lists:all(fun(E) -> true end,[1,2,3,4]).结果true...
分类:
其他好文 时间:
2014-05-07 01:59:17
阅读次数:
552
public class IsInteger {
private IsInteger(){};
public static boolean isInteger(String value) {
try {
Integer.parseInt(value);
return true;
} catch (N...
分类:
其他好文 时间:
2014-05-06 23:27:37
阅读次数:
348
OJ题目:click here~~
题目分析:1……n按顺序围成一个圈,1与n相邻。交换相邻两个数算1步。至少需要多少步,得到一个逆方向的1……n的圈。
分两半,使用冒泡排序,排成逆序的交换次数之和即为结果。
AC_CODE
int f(int n){
return n*(n - 1)/2;
}
int main(){
int n , t;
cin >> t;
...
分类:
其他好文 时间:
2014-05-06 23:15:55
阅读次数:
301
1,有几位数字
#include
int main_2_1_digit(){
int n;
while(scanf("%d",&n)){
int count = 0;
if(n==0)
count = 1;
while(n){
count++;
n/=10;
}
printf("%d\n",count);
}
return 0;
}
...
分类:
其他好文 时间:
2014-05-06 21:20:19
阅读次数:
374
此方法不必删除目录重新下载:针对于第一次成功checkout,一段时间后,update 报此
403错误,我找到了解决方法:即 使用switch 重新定位svn路径,解决这个问题。(附图)ps:能svn checkout
那么你的路径就是正确的,如果大小写错误,svn是不支持checkout。如果是...
分类:
其他好文 时间:
2014-05-06 18:19:39
阅读次数:
354
简单的说,递归就是函数自己调用自己。在数据结构里面会经常使用递归,因为递归代码比较简洁优雅,易懂。编写递归程序时主要注意三点(1)递归总有一个最简单的情况,方法的第一条语句总是包含return的条件语句(2)递归调用总是去尝试解决一个规模更小的子问题,这样递归才能..
分类:
其他好文 时间:
2014-05-06 15:46:13
阅读次数:
289