#SP0000103. Khoảng cách nguyên tố phổ biến nhất (Jumping Champion)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Khoảng cách nguyên tố phổ biến nhất (Jumping Champion)
Jumping Champion
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
List every prime in the closed interval in increasing order. Compute the difference for each consecutive pair. A difference is the jumping champion when it occurs more often than every other difference. Print the champion if it is unique. If there are fewer than two primes, or multiple differences tie for the maximum frequency, print the prescribed no-champion message.
Frequencies are computed using consecutive primes within the chosen interval. A pair crossing an interval boundary is not counted.
Input
One line contains two integers and , the inclusive left and right endpoints of the interval.
Output
If there is a unique champion, print The jumping champion is NUM, replacing NUM with the difference; otherwise print No jumping champion.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Input
2 11
Output
The jumping champion is 2
Explanation
The primes in the interval are , yielding successive differences . The difference occurs twice while each other difference occurs once, so the unique champion is .