pow() is bad !

Revision en1, by 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 !

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Ahmed_Hussein_Karam 2021-02-18 11:14:38 429 Initial revision (published)