#P4132. [BJOI2012] 算不出的等式
[BJOI2012] 算不出的等式
Description
If you really want to play this game, then take a look at my problem first. If you can’t handle these, you won’t be able to clear the game. The first level is actually simple: there is only a locked door with a password. There is a strange formula written on the door; I guess you are supposed to use it to compute the password to open the door (what a cliché).
Legend says that in this expression, and are two odd primes. The computed value should be the password. Can you really not work it out?
$$\sum_{k=1}^{\frac{p-1}{2}} \biggl\lfloor\frac{kq}{p}\biggr\rfloor+\sum_{k=1}^{\frac{q-1}{2}} \biggl\lfloor\frac{kp}{q}\biggr\rfloor$$Input Format
A single line containing two odd primes, denoting .
Output Format
A single number, the value of the expression.
5 7
6
Hint
.
Translated by ChatGPT 5
京公网安备 11011102002149号