Q-1
Edward and Alphonse are alchemists. They want to perform human transmutation to revive their mother and need philosopher stones for it. Father Inc has a factory which produces philosopher stones. The factory will run for n days. On day i the factory will produce A[i] stones. These stones also have a expiry date! The stones produced on day i can only be used for D[i] days. So if D[i] = 1 those stones can only be used on the day they are produced and so on
Edward and Alphonse want to maximise their chances to succeed at the transmutation. For this tell them the maximum number of stones they can use for the transmutation.
Q-2
You are given two strings S and T. An infinitely long string is formed in the following manner. Take an empty string Append S one time Append T two times. Append S three times. Append T four times. and so on, appending the strings alternately and increasing the number of repetitions by 1 each time You will also be given an integer K, you need to tell the Kth Character of this infinitely long string.
Q-3
You are given 4 integers A,B,C and D. You need to find the following sum:
sum = 0
for(i=A;i<=B;i++)
for(j=C;j<=D;j++)
sum = sum + (i^j)
Here ^ nds for the bitwise XOR operation Since the final sum can be huge, you should return the output modulo 1000000007 (10^9 + 7)
Sample Input:
A=1, B = 2, C = 3, D = 4
Sample Output:
14
Explanation:
The required sum would be (1^3)+(1^4) + (2^3) +(2^4) =2+5+1+6=14
[execution time limit] 1 seconds (cpp)
[input] integer a
1 <= A <= 10^9
[input] integer b
A <= B <= 10^9
[input] integer c
1 <= C <= 10^9
[input] integer d
C <= D <= 10^9
[output) integer
The required sum. module 1000000007.