首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

ACMSGURU 499 - Greatest Greatest Common Divisor

Andrew has just made a breakthrough in sociology: he realized how to predict whether two persons will be good friends or not. It turns out that each person has an inner friendship number (a positive integer). And the quality of friendship between two persons is equal to the greatest common divisor of their friendship number. That means there are prime people (with a prime friendship number) who just can’t find a good friend, andWait, this is irrelevant to this problem. You are given a list of friendship numbers for several people. Find the highest possible quality of friendship among all pairs of given people. Input The first line of the input file contains an integer n (2 <= n <= 10000) — the number of people to process. The next n lines contain one integer each, between 1 and 1000000(inclusive), the friendship numbers of the given people. All given friendship numbers are distinct. Output Output one integer — the highest possible quality of friendship. In other words, output the greatest greatest common divisor among all pairs of given friendship numbers.

02

MySQL函数大全及用法示例(二)

数学函数 abs(n) 返回n的绝对值 mysql> select abs(2);   -> 2 mysql> select abs(-32);   -> 32 sign(n) 返回参数的符号(为-1、0或1) mysql> select sign(-32);   -> -1 mysql> select sign(0);   -> 0 mysql> select sign(234);   -> 1 mod(n,m) 取模运算,返回n被m除的余数(同%操作符) mysql> select mod(234, 10);   -> 4 mysql> select 234 % 10;   -> 4 mysql> select mod(29,9);   -> 2 floor(n) 返回不大于n的最大整数值 mysql> select floor(1.23);   -> 1 mysql> select floor(-1.23);   -> -2 ceiling(n) 返回不小于n的最小整数值 mysql> select ceiling(1.23);   -> 2 mysql> select ceiling(-1.23);   -> -1 round(n,d) 返回n的四舍五入值,保留d位小数(d的默认值为0) mysql> select round(-1.23);   -> -1 mysql> select round(-1.58);   -> -2 mysql> select round(1.58);   -> 2 mysql> select round(1.298, 1);   -> 1.3 mysql> select round(1.298, 0);   -> 1 exp(n) 返回值e的n次方(自然对数的底) mysql> select exp(2);   -> 7.389056 mysql> select exp(-2);   -> 0.135335 log(n) 返回n的自然对数 mysql> select log(2);   -> 0.693147 mysql> select log(-2);   -> null log10(n) 返回n以10为底的对数 mysql> select log10(2);   -> 0.301030 mysql> select log10(100);   -> 2.000000 mysql> select log10(-100);   -> null pow(x,y) power(x,y)  返回值x的y次幂 mysql> select pow(2,2);   -> 4.000000 mysql> select pow(2,-2);   -> 0.250000 sqrt(n)  返回非负数n的平方根 mysql> select sqrt(4);   -> 2.000000 mysql> select sqrt(20);   -> 4.472136 pi()  返回圆周率 mysql> select pi();   -> 3.141593 cos(n)  返回n的余弦值 mysql> select cos(pi());   -> -1.000000 sin(n)  返回n的正弦值 mysql> select sin(pi());   -> 0.000000 tan(n) 返回n的正切值 mysql> select tan(pi()+1);   -> 1.557408 acos(n)  返回n反余弦(n是余弦值,在-1到1的范围,否则返回null) mysql> select acos(1);   -> 0.000000 mysql> select acos(1.0001);   -> null mysql> select acos(0);   -> 1.570796 asin(n) 返回n反正弦值 mysql> select a

04

【DB笔试面试668】在Oracle中,什么是高水位?如何回收表的高水位?

Oracle数据库通过跟踪段中的块状态来管理空间。高水位标记(High Warter Mark,HWM)是段中的一个点,超过该点的数据块是未格式化和未使用过的。HWM的信息储存在段头(Segment Header,第一个区的第一个块就称为段头),在段空间是手动管理方式时(MSSM),Oracle是通过Freelist(一个单向链表)来管理段内的空间分配,此时只有HWM的说法;在段空间是自动管理方式(ASSM)时,Oracle是通过BITMAP来管理段内的空间分配,此时Oracle引入了LHWM(Low HWM,低高水位)的概念。在MSSM中,当数据插入以后,如果是插入到新的数据块中,那么数据块就会被自动格式化等待数据访问;而在ASSM中,数据插入到新的数据块以后,数据块并没有被格式化,而是在第一次访问这个数据块的时候才格式化这个块。所以此时又需要一条水位线,用来标示已经被格式化的块,这条水位线就叫做LHWM。LHWM之下的所有块都是已格式化的,要么包含数据,或以前曾包含数据。一般来说,LHWM肯定是低于等于HWM的。在一个ASSM段中的每个数据块处于以下状态之一:

04
领券