|
|
double dif = Math.abs(oform - neoform); if (oform > neoform && dif > 0.000001) { System.out.println("Cash"); } else { System.out.println("Insurance"); } It really helps me to get AC. Thank you Edited by author 23.10.2016 14:05 Edited by author 23.10.2016 14:05 the only idea/key take-away of this problem is to properly combine calculation of integer and floating point numbers Edited by author 15.02.2018 03:31 When you have WA #3, perhaps you check condition in integer values, so use 64-bit integer values. To avoid WA #3 try below test: 100000 10000 10000 100 100 Correct answer is: Cash 51400000.00 Good luck! what test? I think you loose precision. Try to find simple solution without accuracy loosing. |
|
|