一些常用的基础函数实现
2015-06-09 22:35 sylar_liang 阅读(146) 评论(0) 收藏 举报1.求公约数
// return the greatest common divisor
int gcd(int v1, int v2)
{
while(v2)
{
int temp = v2;
v2 = v1%v2;
v1 = temp;
}
return v1;
}
2.
1.求公约数
// return the greatest common divisor
int gcd(int v1, int v2)
{
while(v2)
{
int temp = v2;
v2 = v1%v2;
v1 = temp;
}
return v1;
}
2.