|
|
вернуться в форумNeed help(+) I don't understand, how it is possible to get the answer for the test 50000 3 3 3 3 ... 3 3^50000 has length around 23856. Re: Need help(+) Use long arithmetics :) Re: Need help(+) How do it fast, so it can pass the time limit? Maybe there are some trick there. Long multiplication takes very long time, to do it 50000 times. O(log(50000)) multiplications are enough. (+) Re: Need help(+) I used just long by short (< 2^63) multiplication. Re: Need help(+) Calculate it as ((3^2)^2 * 3)^2 * 3 for 3^11. Re: Need help(+) For calculating product, do we have to see how many consecutive numbers are same so as to calculate product of them by logarithmic power method? Because I see no other way to use the power method of logarithmic time... Re: Need help(+) Note, that given "an integer not exceeding 3 in absolute value" Edited by author 01.01.2009 16:16 Re: Need help(+) x = 3^50000 does x have length 23856 or 23857? does it start in 115 and end in 761000001? |
|
|