测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A14051. Max Correct Set

编程题 普及/提高-

题目描述

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.

输入格式

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

输出格式

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

输入输出样例

输入 #1
10 2 5
输出 #1
5
输入 #2
21 4 6
输出 #2
9
输入 #3
1337 7 7
输出 #3
672
输入 #4
455678451 22 17
输出 #4
221997195
上一题 去做题 下一题