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 2011. Long Statement

Anton Malyuta Runtime error (integer division by zero) in test 70 [10] // Problem 2011. Long Statement 9 Nov 2013 20:20
My code:

/*
Code deleted.
*/

we get the WA12.

What's the problem?

Edited by author 09.11.2013 22:57
AlexandruValeanu Re: Runtime error (integer division by zero) in test 70 [9] // Problem 2011. Long Statement 9 Nov 2013 21:20
You will easily get overflow... 100! ~ 9*10^157 which is a "little" too big
Oh, right! Thank you very much.
It turns out I have the wrong formula?
Thank you very much. I change long long to double. ;)
Vedernikoff 'Goryinyich' Sergey (HSE: АОП) Re: Runtime error (integer division by zero) in test 70 [6] // Problem 2011. Long Statement 10 Nov 2013 18:45
This problem is possible to solve without any formulas - just using one sorting of 3-element array and 3 IF statements - so, you won't have problems with overflows
Thank you.
Thank you. I got AC.
Please, could you explain a bit more your approach?


Edited by author 05.09.2014 03:37
Just got A.C
Just need to change all variable and return values to double.
Count number of 1s 2s and 3s.
Take the factorials of these numbers however you feel right, divide by total length,n.
un_try wrote 4 September 2014 03:42
Please, could you explain a bit more your approach?
Thanks you very much!

I did this: 4 If. One for n > 5, the another threes for n == 5, n == 4 and n == 3.