Logo
(追記) (追記ここまで)

15224번 - EvenOdd 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB132494040.404%

문제

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

1 127

예제 출력 1

1083

예제 입력 2

74 74

예제 출력 2

11

힌트

출처

Contest > KTH Challenge > KTH Challenge 2017 B번

  • 문제를 만든 사람: Johan Sannemo
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /