A helicopter drops two trains, each on a parachute, onto a
straight infinite railway line. There is an undefined
distance between the two trains. Each faces the same
direction, and upon landing, the parachute attached to each
train falls to the ground next to the train and detaches.
Each train has a microchip that controls its motion. The
chips are identical. There is no way for the trains to know
where they are. You need to write the code in the chip to
make the trains bump into each other. Each line of code
takes a single clock cycle to execute.
You can use the following commands (and only these);
MF - moves the train forward
MB - moves the train backward
IF (P) - conditional that's satisfied if the train is next
to a parachute. There is no "then" to this IF statement.
GOTO
Answer Posted / jubalau
had this too. i was allowed to number the lines
1 mf
2 if p go to 4
3 go to 1
4 mf
5 go to 4
you could also add more mf lines between lines 4 and 5 for better results i guess...
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
modulo(373,7)+round(5.8)+truncat(7.2)-round(3.4) = ? i exactly don't remember the truncate function.but the function was where we skip the '.' part.
An article sold at a profit of 20% if both the cost price and selling price would be Rs.20/- the profit would be 10% more. What is the cost price of that article?
Two trains are traveling in 60 kmph on same trace, towards each other. When the distance between them is 18 km, a fly is going to start, flying between them in 80 kmph speed. Find the traveling path distance of the fly upto when it is going to crush by the 2 trains?
How do you convince the retailer to sell you product?
A room is 30 X 12 X 12. a spider is on the middle of the smaller wall, 1 feet from the top, and a fly is on the middle of the opposite wall 1 feet from the bottom. what is the min distance required for the spider to crawl to the fly.
If 4 circles of equal radius are drawn with vertices of a square as the center, the side of the square being 7 cm, find the area of the circles outside the square?
Jane works at a fashion design company,and is having problems getting dressed for work. She refuses to wear any color combination that does not go well together as many of her clients may look down upon this. She has two pairs of skirts, brown and blue; three blouses, white, sky blue, and gray; four pairs of stockings, red, black, brown, and blue; and two pairs of shoes, black and brown. The blue skirt cannot be worn with red or brown stockings. Gray does not go well with brown. Black does not go well with brown. 1. If Jane wears black shoes she will not wear: a) red stockings. b) a blue skirt. c) a white blouse. d) blue stockings. e) a sky blue blouse. 2. If Jane is color blind and is unable to determine what outfits went well together, how many possible clothing combinations could she have? a)24 b)32 c)36 d)44 e)48 3. If Jane wears a brown skirt and a white blouse, she could: a)not wear blue stockings. b)not wear brown shoes. c)not wear black shoes. d)wear blue stockings. e)wear red stockings. 4.Jane buys a gray scarf. If she wears the new scarf, then she could: a)not wear blue stockings. b)not wear brown stockings. c)not wear black shoes. d)wear a white blouse. e)wear black stockings. 5.Jane will never wear: a)blue and red together. b)white and red together. c)gray and blue together. d)white and black together. e)white and red together.
A cylinder is inserted in a sphere d/h = 2/3. Find the surface area of the cylinder ?
Current/most recent employer (Please state full names and address including Country and post code) Current Position Held When would you be available to start work? ONLINE INTERVIEW [INSTRUCTIONS: Give brief answers to all the under listed questions] QUESTIONS ANSWER SPACE 1) What are your years of experience? 2) How do you approach a technical problem? Give an example. How long do you think it would be before you will make a significant contribution to the team/company?
Two pencils costs 8 cents, then 5 pencils cost how much
the ticket sales s for a company increases 25% from standard sales to 60 tickets sold, then 60 - s =:
36:4 :: 9: ?
In 8*8 chess board what is the total number of squares refer oder
mention your extra-curricular interest. Which do you actively pursue? how do you see these developing in the future?
pls help about karnataka bank officers exam paper and guide me about pattern pls total time given and different sub they asked in exam?