Tap here to switch tabs
Problem
Submissions

Problem: Sum of Decoded Numbers

Try to solve the Sum of Decoded Numbers problem.

Statement

You are given an array of positive integers nums.

Each integer nums[i] is encoded using the following format:

  • The last digit represents width_i, which indicates the number of digits in x_i.

  • Removing the last digit leaves a prefix that is split into two integers:

    • x_i is formed by the first width_i digits of the prefix.

    • y_i is formed by the remaining digits of the prefix.

  • The decoded value of nums[i] is xiyix_i^{y_i}.

Return the sum of the decoded values of all elements in nums. Since the result can be large, return it modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 100<100 < nums[i] <1015< 10^{15}

  • 1≤1 \leq width_i ≤9\leq 9

  • 1≤1 \leq x_i, y_i <109< 10^9

  • The digit sequences used to form x_i and y_i do not have leading zeros.

  • It is guaranteed that every element in nums is a valid encoded integer.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sum of Decoded Numbers

Try to solve the Sum of Decoded Numbers problem.

Statement

You are given an array of positive integers nums.

Each integer nums[i] is encoded using the following format:

  • The last digit represents width_i, which indicates the number of digits in x_i.

  • Removing the last digit leaves a prefix that is split into two integers:

    • x_i is formed by the first width_i digits of the prefix.

    • y_i is formed by the remaining digits of the prefix.

  • The decoded value of nums[i] is xiyix_i^{y_i}.

Return the sum of the decoded values of all elements in nums. Since the result can be large, return it modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 100<100 < nums[i] <1015< 10^{15}

  • 1≤1 \leq width_i ≤9\leq 9

  • 1≤1 \leq x_i, y_i <109< 10^9

  • The digit sequences used to form x_i and y_i do not have leading zeros.

  • It is guaranteed that every element in nums is a valid encoded integer.