• [1454] Lux

  • 时间限制: 2000 ms 内存限制: 65535 K
  • 问题描述
  • Lux pretty good at the math. And she is thinking about the prime question.

    Lux want to find the two adjacent primes C1 and C2 (L<=C1< C2<=U) that are closest (i.e. C2-C1 is the minimum) and the two are most distance (i.e. C2-C1 is the maximun).

    If there are other pairs that are the same distance apart, use the first pair.

  • 输入
  • There are muti-case.
    For each test case, contains two integers L and U (1 ≤ L < U ≤ 2, 147, 483, 647).
    (U - L < 1,000,000)
  • 输出
  • For each test case output the two closest adjacent primes and the two most distant adjacent primes.
    If there are no adjacent primes print "-1";
  • 样例输入
  • 2 17
    14 17
  • 样例输出
  • 2 3 7 11
    -1
  • 提示
  • 来源
  • Monkeyde17
  • 操作

显示春菜