ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1074. Very Short Problem

several tricky cases i failed at
Posted by Koala 6 Nov 2009 02:13
1) the exponent may be very large (absolute value). e.g. -100000000000000000000000000000000000.
2) the exponent may pretend to be very large, but actually not. e.g. 000000000000000000000000000000000010
3) 12.e1 is not a valid floating point number, because the dot cannot be the last character of the integral part according to the grammar mentioned.

good luck
Re: several tricky cases i failed at
Posted by [Ural SU] GetTester 27 Nov 2009 12:38
try also tests such as
--1
1
Re: several tricky cases i failed at
Posted by Petr Huggy (Pskov) 2 Jun 2010 13:49
I used conversion String to BigDecimal in Java. But cases 1 and 3 (in Koala's message) should be processed separately.
To process very large negative exponent I used the following
String res;
try {
   res = bd.toPlainString();
}
catch (OutOfMemoryError e) {
// gets here if exp < -1000000
   res = "0.0"; // no need to keep any digits if exp < -200
}
But I don't like it. And maybe it's wrong?
Nevertheless I still have WA 12 :)))


Edited by author 02.06.2010 13:54