ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1234. Bricks

hints
Posted by ASK 20 Mar 2018 16:02
for all-integer comparison you have to use int64_t

do not derive the inequality by hand, use Maxima:

rot(c,s) := matrix([c,-s],[s,c]);
/* D: sqrt(a^2+b^2); */
ma: rot(e/D, sqrt(D^2-e^2)/D);
mb: rot(b/D, a/D);
dd: (ma.mb.[a,-b])[1][1],ratsimp;

load(ineq)$
assume(D>0)$ assume(a>0)$ assume(b>0)$ assume(d>0)$ assume(e>0)$
ne: d >= dd;
ne: (ne * D^2)-2*a*b*e,ratsimp;