### Woburn Challenge 1999

## Good Will Hunting

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**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 x 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`

(note that there is ONE space before and after "x"
and no other spaces elsewhere) All numbers should be rounded to 3 decimal places.
The number '0' denotes the end of data.

### Input

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

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

All Submissions

Best Solutions

**Point Value:** 10

**Time Limit:** 2.00s

**Memory Limit:** 16M

**Added:** Sep 29, 2008

**Languages Allowed:**

C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

## Comments (Search)

Bon Aug 29, 2013 - 12:36:18 am UTC Why does WA on this question appear to be TLE?Alexon Aug 29, 2013 - 1:41:07 am UTC Re: Why does WA on this question appear to be TLE?Bon Aug 29, 2013 - 2:55:29 am UTC Re: Why does WA on this question appear to be TLE?WhiteCometon Feb 16, 2009 - 1:29:03 am UTC What is wrong?"Test Case #1: Runtime Error (Invalid floating point operation)"

what am I doing wrong?

jargonon Feb 16, 2009 - 1:30:31 am UTC Re: What is wrong?WhiteCometon Feb 16, 2009 - 8:59:00 pm UTC Re: Re: What is wrong?Bobon Dec 29, 2008 - 8:47:35 pm UTC Re: Re: Re: Whats wrong with my program?frenzybenzyon Dec 29, 2008 - 9:50:42 pm UTC Re: Re: Re: Re: Whats wrong with my program?held me back 1 hour of test driving

frenzybenzyon Dec 29, 2008 - 8:01:36 pm UTC Whats wrong with my program?hansonw1on Dec 29, 2008 - 8:20:11 pm UTC Re: Whats wrong with my program?(Look at your output and their output VERY closely)

frenzybenzyon Dec 29, 2008 - 5:26:57 pm UTC negativesBobon Dec 29, 2008 - 5:41:48 pm UTC Re: negativeszhxl0903on Dec 20, 2008 - 9:27:48 pm UTC If p is 1, then do we have to output the 1?bbi5291on Dec 20, 2008 - 10:54:52 pm UTC Re: If p is 1, then do we have to output the 1?dAedaLon Dec 09, 2008 - 11:35:57 pm UTC Re: reading inThink about it.

seyonvon Dec 10, 2008 - 4:34:53 am UTC Re: Re: reading inseyonvon Dec 10, 2008 - 4:35:48 am UTC #INFbbi5291on Dec 10, 2008 - 4:07:05 pm UTC Re: #INFEvidently, you either multiplied by 10 too many times, or divided by zero.

Andrewon Nov 13, 2008 - 2:29:43 am UTC wow almost same timeSourSpinachon Nov 13, 2008 - 11:50:21 pm UTC >.<Andrewon Nov 12, 2008 - 11:56:18 pm UTC Negative numbers?dAedaLon Nov 13, 2008 - 2:04:34 am UTC Yesbilgisa1on Oct 28, 2008 - 2:06:50 am UTC question about roundingbbi5291on Oct 28, 2008 - 2:15:07 am UTC Computer scientists never use that rule.