CF1463F.Max Correct Set

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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

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

For the given values nn , xx , and yy , you have to find the maximum size of the correct set.

输入格式

A single line contains three integers nn , xx and yy ( 1n1091 \le n \le 10^9 ; 1x,y221 \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
首页