关于 CSP2023-J1

1

关于为什么不是 $4$ 位小数。

源代码有:

sqrt(s*(s-a)*(s-b)*(s-c));

当 $a=1,b=2,c=4$ 时,有:

$s=\lfloor(a+b+c)/2\rfloor=\lfloor(1+2+4)/2\rfloor=3$。

代入源代码表达式得:

$\sqrt{s\times(s-a)\times(s-b)\times(s-c)}=\sqrt{3\times(3-1)\times(3-2)\times(3-4)}=\sqrt{3\times2\times1\times(-1)}=\sqrt{-6}=\dots$

F*** C**!

posted @ 2023-09-16 19:02  changwenxuan  阅读(9)  评论(0)    收藏  举报  来源