HBC252118肥猪的钢琴床,动态规划Transformation题解

柳絮泡泡 算法基础篇 42 0
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。
Given an array of length nnn, it undergoes a transformation every second.In each transformation, the number in the first position will be merged with the number in the second position, the number in the third position will be merged with the number in the fourth position, and so on. This will continue until there are only two numbers left in the array.Since the length of this array can be very large, Christina used a new method when giving you the data. Christina will give you kkk pieces of information. Each piece of information contains two positive integers a,ba, ba,b, indicating that there is a segment of length aaa in the array, and all the numbers in the segment are bbb. Since the answer may be very large, please take the result modulo 109+710^9+7109+7.

Given an array of length nnn, it undergoes a transformation every second. In each transformation, the number in the first position will be merged with the number in the second position, the number in the third position will be merged with the number in the fourth position, and so on. This will continue until there are only two numbers left in the array. When merging two numbers, their sum will be calculated. For example, the array [1, 2, 3, 4, 5] will become [3, 7, 5] after the first second (the first two numbers are merged, the third and fourth numbers are merged, and since there is no sixth number, the fifth number remains unchanged). It will become [10, 5] after the second second, at which point only two numbers remain, and the transformation ends. Christina wants to know the sum of the squares of the last two numbers. For example, in the above array, the square sum is 102+52=12510^2 + 5^2 = 125102+52=125. Since the length of this array can be very large, Christina used a new method when giving you the data. Christina will give you kkk pieces of information. Each piece of information contains two positive integers a,ba, ba,b, indicating that there is a segment of length aaa in the array, and all the numbers in the segment are bbb. Since the answer may be very large, please take the result modulo 109+710^9+7109+7.

HBC252118肥猪的钢琴床,动态规划Transformation题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
全网最全C++题库,助您挑战自我,突破极限,成为编程领域的佼佼者!

标签: HBC252118肥猪的钢琴床 动态规划Transformation题解