report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Divisors counting - MarisaOJ: Marisa Online Judge

Divisors counting

Time limit: 1000 ms
Memory limit: 256 MB
Let $f(x)$ be the number of positive divisors of an integer $x$. You are given $q$ queries, each of the form $(l, r)$. Calculate: $$f(l) + f(l + 1) + ... + f(r)$$ ### Input - The first line contains an integer $q$. - The next $q$ lines, each line contains 2 integers $l, r$, a query. ### Output - Print $q$ lines, the answers to $q$ queries. ### Constraints - $1 \le q \le 10^5$. - $1 \le l, r \le 10^6$. ### Example Input: ``` 1 1 4 ``` Output: ``` 8 ```
Basic number theory
Prime number 2
Sieve of Eratosthenes
Segmented sieve
Prime factors
Maximum GCD
Divisors counting
Largest common divisor
Nearest Element
Divisors counting 2
GCD and LCM
GGCD
Square root sum
Square number
Sum sum sum
Topic
Prefix sum
Math
Rating 1000
Solution (1) Solution