pow() is bad !

Правка en1, от Ahmed_Hussein_Karam, 2021-02-18 11:14:38

One lesson I have learned on last Div #3 contest is "avoid using pow() function in C++, it is can lead to Wrong Answer".

I am sharing this with a practical example:

This submission works only if you replace long long p = pow(n1, 3) + pow(mid, 3);

with long long p = n1 * n1 * n1 + mid * mid * mid;

I feel like it is useful to sare it !

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Ahmed_Hussein_Karam 2021-02-18 11:14:38 429 Initial revision (published)