102533: [AtCoder]ABC253 D - FizzBuzz Sum Hard
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Score : $400$ points
Problem Statement
Find the sum of integers between $1$ and $N$ (inclusive) that are not multiples of $A$ or $B$.
Constraints
- $1 \leq N, A,B \leq 10^9$
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
$N$ $A$ $B$
Output
Print the answer.
Sample Input 1
10 3 5
Sample Output 1
22
The integers between $1$ and $10$ (inclusive) that are not multiples of $3$ or $5$ are $1,2,4,7$, and $8$, whose sum is $1+2+4+7+8 =22$.
Sample Input 2
1000000000 314 159
Sample Output 2
495273003954006262
Input
题意翻译
求 $1$ 到 $n$ 之间(闭区间)所有整数中。除了 $a$ 和 $b$ 的倍数之外的整数之和。 - $1 \le N,A,B \le 10^9$ - 输入数据均为整数。Output
分数:400分
问题描述
找出在$1$和$N$(包括)之间的整数,这些整数不是$A$或$B$的倍数。
限制条件
- $1 \leq N, A,B \leq 10^9$
- 输入中的所有值都是整数。
输入
从标准输入以以下格式获取输入:
$N$ $A$ $B$
输出
打印答案。
样例输入 1
10 3 5
样例输出 1
22
在$1$和$10$(包括)之间的整数,不是$3$或$5$的倍数的有$1,2,4,7$和$8$,它们的和为$1+2+4+7+8 =22$。
样例输入 2
1000000000 314 159
样例输出 2
495273003954006262