Preparando MOJI

Max Correct Set

4000ms 262144K

Description:

Let's call the set of positive integers $$$S$$$ correct if the following two conditions are met:

  • $$$S \subseteq \{1, 2, \dots, n\}$$$;
  • if $$$a \in S$$$ and $$$b \in S$$$, then $$$|a-b| \neq x$$$ and $$$|a-b| \neq y$$$.

For the given values $$$n$$$, $$$x$$$, and $$$y$$$, you have to find the maximum size of the correct set.

Input:

A single line contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^9$$$; $$$1 \le x, y \le 22$$$).

Output:

Print one integer — the maximum size of the correct set.

Sample Input:

10 2 5

Sample Output:

5

Sample Input:

21 4 6

Sample Output:

9

Sample Input:

1337 7 7

Sample Output:

672

Sample Input:

455678451 22 17

Sample Output:

221997195

Informação

Codeforces

Provedor Codeforces

Código CF1463F

Tags

bitmasksdpmath

Submetido 0

BOUA! 0

Taxa de BOUA's 0%

Datas 09/05/2023 10:09:28

Relacionados

Nada ainda