CF1891D.Suspicious logarithms
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Let f ( x ) be the floor of the binary logarithm of x . In other words, f ( x ) is largest non-negative integer y , such that 2y does not exceed x .
Let g ( x ) be the floor of the logarithm of x with base f ( x ). In other words, g ( x ) is the largest non-negative integer z , such that f(x)z does not exceed x .
You are given q queries. The i -th query consists of two integers li and ri . The answer to the query is the sum of g ( k ) across all integers k , such that li≤k≤ri . Since the answers might be large, print them modulo 109+7 .
输入格式
The first line contains a single integer q — the number of queries ( 1≤q≤105 ).
The next q lines each contain two integers li and ri — the bounds of the i -th query ( 4≤li≤ri≤1018 ).
输出格式
For each query, output the answer to the query modulo 109+7 .
输入输出样例
输入#1
12 4 6 4 7 4 8 4 100000 179 1000000000000000000 57 179 4 201018959 7 201018960 729 50624 728 50624 728 50625 729 50625
输出#1
6 8 9 348641 41949982 246 1 0 149688 149690 149694 149692
说明/提示
The table below contains the values of the functions f ( x ) and g ( x ) for all x such that 1≤x≤8 .
x 1 2 3 4 5 6 7 8 f 0 1 1 2 2 2 2 3 g − − − 2 2 2 2 1