原题来自:Waterloo local,题面详见 POJ 2689
给定两个整数 L,R,求闭区间 [L,R] 中相邻两个质数差值最小的数对与差值最大的数对。当存在多个时,输出靠前的素数对。
第一行输入n,接下来每行输入两个数 L,R。
详见输出样例。
2
2 17
14 17
2,3 are closest, 7,11 are most distant.
There are no adjacent primes.
对于全部数据,1≤L<R<231,R−L≤106。
In following homework:
By signing up a Hydro universal account, you can submit code and join discussions in all online judging services provided by us.