Java Interview Report
- 0of 0 votes
AnswerDistributing Medals It's the medal distribution ceremony. 10^6 police officers, numbered from 1 to 10^6, are standing in a line. There are N (1<=N<=1000) iterations of medal distribution. In iteration i (0 < = i < N), count[i] ( 1 < = count[i] < = 100) medals are given to all officers from from[i] to to[i] ( 1 < = from[i] < = to[i] < = 10^6 )
- BABUBTECH786 September 13, 2014 in United States
If we sum up the number of medals received starting from the first officer, who would be the first officer for which the cumulative sum exceeds a given medal count THRESHOLD ( 1 < = THRESHOLD < = 10^9 )?
Input/Output Specifications Input format:
You are given 5 inputs:
input1 = N, the number of iterations
input2 = count, the array of medal counts in each iteration
input3 = from, the array of starting indices in each iteration
input4 = to, the array of ending indices in each iteration
input5 = THRESHOLD, the medal count threshold
Output format:
An integer, representing the number of the first officer such that the cumulative sum of medals starting from the first officer upto this officer exceeds THRESHOLD. The output should be -1 if such an officer does not exist| Report Duplicate | Flag | PURGE
Java - 0of 0 votes
AnswersJudgement Day
- BABUBTECH786 September 13, 2014 in United States
Skynet has figured out a way to take over the world. It will keep producing robots and molecular assemblers until it has converted all matter for its own purpose. Robots work to produce more robots and molecular assemblers. Molecular assemblers convert matter into programmable matter to be used to produce more robots and molecular assemblers.
Initial Info On day 0, Skynet started with 3 robots, 1 molecular assembler and 0 units of programmable matter.
On day i (i>0), robots produced can be calculated as the sum of the robots produced on the previous day and thrice the units of programmable matter produced on the previous day.
On day i, number of molecular assemblers produced can be calculated as the sum of robots produced on the previous day and twice the units of programmable matter produced on the previous day.
On day i, the units of programmable matter produced can be calculated as five times the number of molecular assemblers produced on the previous day.
How many robots, molecular assemblers and units of programmable matter will be produced on the Judgement Day (day n)?
Input/Output Specifications
Input format: Two integers x and y (1<=x,y<=10^6) such that the judgement day falls on day n = x*y.
Output format: Since the number of robots, molecular assemblers and units of programmable matter grows very rapidly, we want you to output them modulo 1000000007.
The output should be a string having the following format: R#M#P, where - R is the number of robots produced on judgement day modulo 1000000007 - M is the number of molecular assemblers produced on judgement day modulo 1000000007 - P is the number of units of programmable matter produced on judgement day modulo 1000000007| Report Duplicate | Flag | PURGE
Java