Click here to Skip to main content
15,883,889 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
NEED JAVA CODE FOR THIS PUZZLE

Judgement Day

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

Need Java Code For above Problem
Posted
Comments
Mehdi Gholam 13-Sep-14 2:04am    
Good luck with the homework assignment.
Richard MacCutchan 13-Sep-14 4:45am    
We don't provide code to order, you are expected to write it. If this problem is too difficult for you then try something simpler.

1 solution

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!
 
Share this answer
 
Comments
Johnny Carter 13-Sep-14 4:36am    
Sir, actually i unable to find out the exact problem i just need startup, i have three or more puzzle look alike the above one if i got dis one then i'll easy handle rest of the problems,please sir help me
Johnny Carter 13-Sep-14 4:37am    
Its not my homework or assignment its a code challenge
OriginalGriff 13-Sep-14 4:53am    
So...you want us to do something for you so you can look like you know more than you do?

No - give it a try yourself. If you can't solve it, then look for a simpler task.
Johnny Carter 14-Sep-14 1:22am    
import java.io.*;
public class CandidateCode
{
public static void main (String args[])
{
int ans=JudgementDay(new input1(1), int new input2(2));
System.out.println(ans);

}


public static String JudgementDay(int input1,int input2)
{
int robots=3;
int MI=1;
int PU=0;
long day;
for(int i=0;i<=1000000;i++)
{
robots=robots+3*(PU);
MI=robots+2*(PU);
PU=5*(MI);

}
return null;
}
}
Johnny Carter 14-Sep-14 1:23am    
i'll do the above work in my code but still i unable to reach at final position,pls anyone can help me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900