Who won a Game of Bar Dice?

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

DECLARE @ table(p int,v int)
INSERT @ values(1,5),(1,5),(1,5),(1,5),(1,1)
INSERT @ values(2,6),(2,6),(2,6),(2,6),(2,6)

SELECT sign(min(u)+max(u))FROM(SELECT(p*2-3)*(s+sum(1+1/~s-1/v))*(s/5*5+v+30)u
FROM(SELECT*,sum(1/v)over(partition by p)s FROM @)c GROUP BY v,s,p)x

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results