Velma and Triplets
Practice
4.2 (23 votes)
Ad Hoc
Combinatorics
Easy
Implementation
Math
Problem
78% Success 8143 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Given an array of size N, Velma give Scooby and Shaggy to compute the following sum on the array (0-indexed array).
enter image description here,
where \(\lfloor.\rfloor\) is the floor operator.
Since it was taking too long for Scooby and Shaggy to compute the sum, they need your help.
Can you help them?

Input

The first line of input will contain a single integer N, denoting the size of the array.
The second line will contain N integers arr0, arr1, arr2, ..., arrn-1.

Output

Print a single integer, the answer to Velma's question.

Constraints

  • \( 1 \leq N \leq 100, 1 \leq arr_{i} \leq 1000 \) in 40% of test cases.
  • \( 1 \leq N \leq 3 \cdot 10^5, 1 \leq arr_{i} \leq 5*10^4 \) in 60% of test cases.

Note: The answer will fit in signed 64-bit integer

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
6 votes
Tags:
CombinatoricsEasyMath
Points:20
14 votes
Tags:
CombinatoricsEasyMath
Points:20
29 votes
Tags:
ApprovedCombinatoricsEasyMath