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

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

578C - Слабость и бедность My submission here 19371924 gives WA test 30 and I can't find out why. I am using ternary search and Kadane's algorithm. Help please!

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

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

I don't see the reason to write this:

cout << fixed << setprecision(7) << calc(round(b * 1000000)/1000000) << endl;

This would lose accuracy of your answer, right?

The following is correct one.

cout << fixed << setprecision(7) << calc(b) << endl;

Another mistake is here:

while (c - b > 0.0000000001) // 1e-10
{
	/**************/
}

The error on number x will be increased by about n times when calculating weakness. So it should be 1e-12.

BTW, it is better to run a certain number of iteration for binary(ternary) search on float number.