CF1463F.Max Correct Set

NOI/NOI+/CTSC

通过率:0%

时间限制:4.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

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

  • S⊆1,2,…,nS \subseteq {1, 2, \dots, n};
  • if a∈Sa \in S and b∈Sb \in S, then ∣a−b∣≠x|a-b| \neq x and ∣a−b∣≠y|a-b| \neq y.

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

我们称正整数集合 SS 是“正确的”,当且仅当满足以下两个条件:

  • S⊆{1,2,…,n}S \subseteq \{1, 2, \dots, n\};
  • 若 a∈Sa \in S 且 b∈Sb \in S,则 ∣a−b∣≠x|a-b| \neq x 且 ∣a−b∣≠y|a-b| \neq y。

给定 nn、xx 和 yy 的值,你需要求出“正确”集合的最大可能大小。

输入格式

A single line contains three integers nn, xx and yy (1≤n≤1091 \le n \le 10^9; 1≤x,y≤221 \le x, y \le 22).

一行包含三个整数 nn、xx 和 yy(1≤n≤1091 \le n \le 10^9;1≤x,y≤221 \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

输入解题思路,AI测评打分。不知道怎么写?

首页