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 1083. Factorials!!!

Why 9 !! is 945?
Posted by tigergr 4 Jun 2015 18:12
According to input data 9!! = 9(9-1*2)(9-2*2)(9mod2) = 9*7*5*1=315

Edited by author 04.06.2015 18:13

Edited by author 04.06.2015 18:13
Re: Why 9 !! is 945?
Posted by morbidel 4 Jun 2015 20:03
You forgot the multiplication with 3.
9 !! = 9(9-1*2)(9-2*2)(9-3*2)(9-4*2) = 9 * 7 * 5 * 3 * 1 = 945
The formula presented in the text has some "...", meaning that the product continues until the last member is either n mod k (in case n doesn't divide k) or k (in the other case).
Re: Why 9 !! is 945?
Posted by Rayhan Ahmed 25 Aug 2015 20:37
it will minus(-) what your input in string.... like you input (!!!) and enter 9,,,so
there 9-3=6 then 6-3=3 then 3-3=1 so 9*6*3*1=162

so that's why u can solve this by 9 !!==> 9-2=7,7-2=5,5-2=3,3-2=1;
so 9*7*5*3*1=945.

that's it