CSDN链接两个自然数的积等于这两个数的最大公约数与最小公倍数的积。求最大公约数的方法:1、辗转相除法:辗转相除法又称为欧几里德算法其计算原理依赖于下面的定理:定理:gcd(a,b)
= gcd(b,a mod b) (a>b 且a mod b 不为0)当b==0时,gcd(a,b)中的a即为最大公...
分类:
其他好文 时间:
2014-05-26 11:19:49
阅读次数:
263
什么是GCDGrand Central Dispatch
(GCD)是Apple开发的一个多核编程的解决方法。该方法在Mac OS X
10.6雪豹中首次推出,并随后被引入到了iOS4.0中。GCD是一个替代诸如NSThread, NSOperationQueue,
NSInvocationOper...
分类:
其他好文 时间:
2014-05-26 07:53:12
阅读次数:
251
简介线程是在一个程序中并发的执行代码的方法之一。虽然有一些新的技术(operations,
GCD)提供了更先进高效的并发实现,OS
X和iOS同时也提供了创建和维护线程的接口。这里将要介绍线程相关的包以及如何使用他们。同时也会介绍程序中多线程代码的同步。关于线程开发多年以来,电脑的最大处理速度受制...
分类:
移动开发 时间:
2014-05-26 07:00:02
阅读次数:
306
什么是GCDGrand Central Dispatch
(GCD)是Apple开发的一个多核编程的解决方法。该方法在Mac OS X
10.6雪豹中首次推出,并随后被引入到了iOS4.0中。GCD是一个替代诸如NSThread, NSOperationQueue,
NSInvocationOper...
分类:
其他好文 时间:
2014-05-26 06:22:50
阅读次数:
297
uva 10104 Euclid Problem (数论-扩展欧几里德)
题目大意:
已知 A 和 B , 问你 A*X+B*Y=GCD(A,B)的 X,Y解。
解题思路:
非常裸的拓展欧几里德算法。
拓展欧几里德算法证明过程:
因为 B*X1+A%B*Y1=GCD(B,A%B) =GCD(A,B)=A*X+B*Y
所以 B*X1+(A-A/B*B)*Y1=A*X+B*Y
A*Y1+B*(X1-A/B*Y1)=A*X+B*Y
于是: X=Y1,Y=(X1-A/B*Y1)
因此,得出( A*...
分类:
其他好文 时间:
2014-05-26 05:53:55
阅读次数:
297
求最大公约数。 1 //Accepted 228 KB 0 ms 2 #include 3
#include 4 int gcd(int a,int b) 5 { 6 if (b==0) return a; 7 return gcd(b,a%b); 8
} 9 int...
分类:
其他好文 时间:
2014-05-26 02:54:42
阅读次数:
199
题意:给定两个数G,T,求a,b使gcd(a,b)=G,lcm(a,b)=T;解题思路:1.T%G==0,否则无解。
2.输出a=gcd(a,b)=G,b=lcm(a,b)=T; 1 //Accepted 0 KB 16 ms 2 #include 3 #inclu...
分类:
其他好文 时间:
2014-05-26 02:47:24
阅读次数:
208
求解ax+by=gcd(a,b)通解:x=x0+b*t;y=y0-a*t; 1 __int64
a,b,x,y; 2 __int64 extend_euclid(__int64 a,__int64 b,__int64 &x,__int64
&y) 3 { 4 if (b==0) 5 ...
分类:
其他好文 时间:
2014-05-26 02:46:40
阅读次数:
198
Problem Description
Some days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big number with it.
But I also don't want to use...
分类:
其他好文 时间:
2014-05-25 16:39:53
阅读次数:
266
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,
0), ^{ NSString *urlString = @"http://img0.pconline.com.cn/pconline/1...
分类:
移动开发 时间:
2014-05-24 09:10:22
阅读次数:
324