LIFERACE - LIFE IS A RACE
Life is a race with hard working humans . Assume a hypothetical situation in which God has to send many humans on earth with some level of intelligence . Level of intelligence is measured in a whole number. God has to take care that person arriving later on earth should have more level of intelligence so as to cope with the competitive world. God’s assistant suggested him a non-decreasing sequence called S . Lets see the sequence.
Description of Sequence:
Any natural number n occurs exactly S[n] times and all n occurs consecutively. Few terms are stated below.
n 1 2 3 4 5 6 7 8 9 10 11 12…………….....
S(n) 1 2 2 3 3 4 4 4 5 5 5 6…………………
So , Person 1 arrives on earth with level of intelligence=1
Person 2 arrives on earth with level of intelligence=2
Person 3 arrives on earth with level of intelligence=2
Person 4 arrives on earth with level of intelligence=3
And so on….
But God sends some Good hearted Person(Person who not only lives for themselves but for the world) when n ‘s cube root is a Positive integer. But there is a SuperGod which rarely opens his eyes and as he opens his eyes ,he increases the level of intelligence of some of the Good Hearted Persons. Now God needs to know the total level of intelligence of some of the Good Hearted People.
Good hearted Person 1: Person 1
Good hearted Person 2: Person 8
Good hearted Person 3: Person 27
Good hearted Person 4: Person 64
And so on…..
God needs a programmer to solve his queries. God’s input data Format is explained Below.
Will You help God??(He might increase your lifetime :) )
First line of input contains 2 integer, x and y, where x denotes the number of time the SuperGod opened his eyes and y denotes the number of queries of God.
Next x lines follows 3 integers L,R,I ,which denotes that SuperGod has increased the Level of Intelligence of Good Hearted People ranging between L and R(inclusive both) by a constant I.
Next y lines follows 2 integers L,R ,which denotes that God needs to know the Total level of intelligence of Good Hearted Persons ranging between L and R(inclusive both).
Good Hearted Person L is Person L*L*L
Good Hearted Person L+1 is Person (L+1)*(L+1)*(L +1)
Good Hearted Person R is Person R*R*R
Output should contain exactly y lines ,each containing the answer.
1 1 1
Explanation of Test Data:
Asnwer is S+S[2*2*2]+1=6
It makes a very little difference if you describe how S[n] progresses, because people will get that from OEIS anyway. So hiding those details doesn't necessarily make this problem special.
I don't understand well the question, but is it very different from the classical SEQ7 ? If no, this problem will be moved.
@RAJDEEP GUPTA: n occurs S[n] Times as mentioned in the problem statement
I could not understand how S[n] progresses. Are we supposed to infer it ourselves?
mala da.... annamala:
Can i get some more test cases