ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1285. Thread in a Hyperspace

Geometrical question
Posted by Samsonov Alex [USU] 5 Jan 2007 23:01
Can anybody explain me, where am I wrong?

Definitions:
ac, ab, bc - corresponding lengths
acb - angle between (ca) and (cb)

Such code:
...
acb = acos((ac*ac + bc*bc - ab*ab) / 2.0 / ac / bc);
..

gets AC.

Such code:
...
double spv(point x1, point x2, point y1, point y2){
int i;
double res = 0;
for (i=1; i<=n; i++){
res += (x2.coord[i] - x1.coord[i]) * (y2.coord[i] - y1.coord[i]);
}
return res;
}
...
acb = acos(spv(c,a,c,b)/ac/bc);...
...

gets WA25.

I had always thought that these two fragments must yield the same result. Why don't they?
Re: Geometrical question
Posted by r1d1 20 Aug 2009 00:27
me too. If you get WA27, use type double