시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 95 | 33 | 28 | 42.424% |
Consider the following function f(X), which takes a single positive integer as argument, and returns an integer.
function f(X): iterations := 0 while X is not 1: if X is even: divide X by 2 else: add 1 to X add 1 to iterations return iterations
It can be shown that for any positive integer X, this function terminates. Given an interval [L, R], compute the sum
S = f(L) + f(L + 1) + · · · + f(R − 1) + f(R).
The first and only line of input contains two integers L and R (1 ≤ L ≤ R ≤ 1018).
Output the result S modulo the prime 109 + 7.
1 127
1083
74 74
11
Contest > KTH Challenge > KTH Challenge 2017 B번