WC '99 P5 - Good Will Hunting

View as PDF

Submit solution

Points: 5
Time limit: 1.0s
Memory limit: 16M

Problem type
Woburn Challenge 1999

Many viewers of the movie were so taken by Matt Damon that they never realized that he knows no physics whatsoever. The painful reality of this was finally revealed at a recent press junket when a bitter physics professor named Dr. Peter Plachta asked Damon to convert a number to scientific notation (apparently Dr. Plachta was incredulous when he realized that somebody in the physics world was more popular than he was). So anyway, when Damon was unable to answer the question, his agent began damage control by hiring a team of programmers to write him a program that would do this conversion for him.

You will need to convert a real (floating point) number to scientific notation, i.e. a number of the form x.yzw\times 10^P, where the digit x is non-zero, the digits y, z, w are possibly zero, and P is a non-zero integer. If P is zero, simply output x.yzw. Therefore, the number 1234.0 is 1.234 \times 10^3 in scientific notation. However, since superscript is a little tough to do in a text-based system, the above answer would be outputted as follows: 1.234 x 10^3. All numbers should be rounded to 3 decimal places. The number 0 denotes the end of data.

Input Specification

A series of test cases, terminated by the number 0.

Output Specification

For each test case, output the number in properly formatted scientific notation.

Sample Input

1234.56
1.2
0.098
0

Sample Output

1.235 x 10^3
1.200
9.800 x 10^-2

Comments

There are no comments at the moment.