Sum of Digits
Practice
0 (0 votes)
Ad Hoc
Approved
Easy
Approved
Problem
32% Success 2665 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are given an array of N distinct numbers. Now, we call the Digit Value of a number to be the sum of its digits..

Now, a subset is a set of not-necessarily-contiguous array elements. We call the value of a set to be the the maximum over the Digit Value of all elements it contains.

Now, you need to find the summation of the values of all \(2^{N}-1\) non-empty subsets of this array. As the answer can be rather large, print it Modulo \( 10^9+7 \). Can you do it ?

Input Format :

The first line contains a single integer N. The next line contains N space separated integers, where the \(i^{th}\) integer denotes \(A[i]\).

Output Format :

Print the summation of the value of each non-empty subset of the given array Modulo \(10^9+7\).

Constraints :

\( 1 \le N \le 10^{5} \)

\( 0 \le A[i] \le 10^{18} \)

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
16 votes
Tags:
Easy
Points:20
93 votes
Tags:
Inversion CountSortingAlgorithmsAdvanced Sorting
Points:20
245 votes
Tags:
Easy
Editorial

No editorial available for this problem.