Блог пользователя BrendonSlash

Автор BrendonSlash, история, 8 лет назад, По-английски

For this problem http://codeforces.com/problemset/problem/492/B. I've used a binary search approach to get a solution. However, I'm getting an incorrect result in the floating points for the answer. How can I overcome this.

This is my solution http://codeforces.com/contest/492/submission/17201833

  • Проголосовать: нравится
  • -16
  • Проголосовать: не нравится

»
8 лет назад, # |
Rev. 10   Проголосовать: нравится 0 Проголосовать: не нравится

First of all, you must output using "fixed" floating format, which says to output system to print N digits after the '.'

cout << fixed << setprecision(6) << d;

Also, the problem statement says, that 9 digits are significant in the answer, so it would be better to output using setprecision(9). Double data type gives 15-17 significant digits, so it's enough, I think

UPD: Checker is quite funny, this verdict looks really weird