CF1463F.Max Correct Set
NOI/NOI+/CTSC
通过率:0%
时间限制:4.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Let's call the set of positive integers S correct if the following two conditions are met:
- S⊆1,2,…,n;
- if a∈S and b∈S, then ∣a−b∣=x and ∣a−b∣=y.
For the given values n, x, and y, you have to find the maximum size of the correct set.
我们称正整数集合 S 是“正确的”,当且仅当满足以下两个条件:
- S⊆{1,2,…,n};
- 若 a∈S 且 b∈S,则 ∣a−b∣=x 且 ∣a−b∣=y。
给定 n、x 和 y 的值,你需要求出“正确”集合的最大可能大小。
输入格式
A single line contains three integers n, x and y (1≤n≤109; 1≤x,y≤22).
一行包含三个整数 n、x 和 y(1≤n≤109;1≤x,y≤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测评打分。不知道怎么写?