sumecif2
Let's define f(n) as the sum n. Given an interval [ A, B ], find a number k that appears the most in the array f(A), f(A + 1), f(A + 2), ..., f(B - 1), f(B). In the case that more such numbers appear same number of times, output the largest value for k.
InputThe first line contains two integers A and B (1 <= A <= B <= 1.000.000.000.000).
OutputOutput k
Input:
Output:
Explanation:
The values of the function f for arguments 6, 7, ..., 17 are: 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8. The numbers 6, 7 and 8 appear twice ,hence we output 8
6 17Output:
8Explanation:
The values of the function f for arguments 6, 7, ..., 17 are: 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8. The numbers 6, 7 and 8 appear twice ,hence we output 8
Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.