Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Euclidean Adjustments An astronomer is making measurements with his telescope when he notices that his vision field is off by x micronanometers (which we will

Euclidean Adjustments

An astronomer is making measurements with his telescope when he notices that his vision field is off by x micronanometers (which we will assume is a measurement that exists) to the right. His telescope can only be moved to the right or to the left, however, and only via his automated, highly-calibrated machinery by certain predetermined fixed integer amounts. If, for example, one of these amounts is 7 micronanometers, then he can move his vision field by any multiple of 7 micronanometers to the left or right. Given a value of x and a set {m1, m2, . . . , mn} of predetermined fixed movement amounts, your job will be to advise the astronomer as to which of the movements to choose, how many times the movement should be applied, and the direction of the movement so that he can make his field of vision perfect. You may assume that x is a standard Java integer, but you may want to use the java.BigInteger class for the mi . It is guaranteed that a solution exists.

Input/Output

The input file (input.txt) in the home directory will consist only of positive integers. The first line will be the value of x. The following lines will hold the values of the mi , one per line. Your output file (output.txt) should hold a sequence of lines with 2 singlespace-separated numbers per line. These will be interpreted as instructions for telescope movement. The line mi y will mean to move the telescope mi micronanometers y times. (If y is positive, then it will be moved to the right; if y is negative, then it will be moved to the left.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases In Networked Information Systems 6th International Workshop Dnis 2010 Aizu Wakamatsu Japan March 2010 Proceedings Lncs 5999

Authors: Shinji Kikuchi ,Shelly Sachdeva ,Subhash Bhalla

2010th Edition

3642120377, 978-3642120374

More Books

Students also viewed these Databases questions

Question

5. Our efficiency focus eliminates free time for fresh thinking.

Answered: 1 week ago