Hi!

Tomorrow, January, 22-nd at 11:00 o'clock (Moscow timezone), will have place **Codeforces Round #104**! The problemsetter will be me, Herasymiv Vitaliy (witua). Thanks a lot to Artem Rakhov (RAD) for help in praparing the problems and Maria Belova (Delinur) for problems translation.

I hope you will like this round.

See you tomorrow!

Points destribution today is:

DIV1: 500-1000-1500-2500-2500

DIV2: 500-1000-1500-2000-2500

Thanks to all, and here are the results:

Division 1:

Division 2:

Good luck to all contestants :-)

And what about believing in wishes... Notwithstanding wishes count rating system have such a magic property that total points won (for all contestants) roughly equals total points lost.as fast as possible:)As n!/k!/(n-k)!. Modulo division can be performed with multiplication by inverse (http://en.wikipedia.org/wiki/Modular_multiplicative_inverse). For prime modulo p, the inverse of a can be found using Euler's theorem as a^(p-2). It can be calculated using fast exponentiation in O(log N).

If you need to calculate your formula many times, you can use particular sums (sorry if it wrong. in russian the popular name for it is частичная сумма) for unchanging var p. Like precalculating. e.g. for array: a = [1,2,3,5,6,12,4]. for each element we calculate s[i]. s[i] = a[0] + a[1] + ... + a[i]. So we can use formula: s[0] = a[0], s[i] = s[i - 1] + a[i] (i > 0) to calculate it. i.e. after calculating, we have s = [1, 3, 6, 11, 17, 29, 33]. So if you want to calculate a[l + 1] + ... + a[r - 1] + a[r], just use s[r] - s[l].

P.S. you can change the line sum([int(k*p/q) for k in range(1,(q+1)/2)]) to sum(k*p//q for k in range(1,(q+1)//2)). I think it will be faster than the first one.

P.P.S. I didn't check it for python2.7, but for python3.2 it should work.

use multiplicative inverse

look @ the "up" vote for your post! :) (its +47 )

{lets make it +74)

And now this comment has +47:

47to the rating (just another lucky number :)[frequency of its occurrence on this page taken into account]

Your contribution is : +47 which is lucky

I hope I will get +117 rating increase in the next Codeforces Round.

It is lucky multiplication (1 x 1 x 7 = 7), and my rating will be 2023 + 117 = 2140, it is lucky sum (2 + 1 + 4 + 0 = 7).

ha ha ha ha :)

Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

decimal record contains only the lucky digits4 and 70 is not a lucky digit.Could someone tells me the solution of problem D || E of div1 ? Many thanks ~!