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

Division problem

Time limit: 2000 ms
Memory limit: 256 MB
Given a set $A$ consisting of $n$ distinct integers. There are $n \times (n-1) \times (n-2)$ ways to choose three integers $a, b, c$ from the set. Calculate the sum of $\lfloor \frac{a}{b} \rfloor \lfloor \frac{a}{c} \rfloor \lfloor \frac{b}{c} \rfloor$ for all ways to choose three integers $a, b, c$. ### Input - The first line contains an integer $n$. - The second line contains $n$ distinct integers in the set $a$. ### Output - Print the sum of $\lfloor \frac{a}{b} \rfloor \lfloor \frac{a}{c} \rfloor \lfloor \frac{b}{c} \rfloor$ modulo $2^{32}$ for all choices. ### Constraints - $1 \leq n \leq 5000$. - The elements are positive integers not exceeding $5000$. ### Example Input: ``` 4 1 2 3 4 ``` Output: ``` 36 ```
Additional Problems (Level 5)
GCD 2
Brewing potion 9
Amusement park
Growing mushrooms III
Queries on tree 3
Division problem
Watering II
Growing mushrooms II
Squid game
The last Ballade...
Sum of weights
Mushroom harvesting II
Flip
Pairs' value
Sorting queries
Microsoft Paint
Gene bank
Card games
Sequence
Topic
Math
Rating 1900
Solution (1) Solution