CF710D.Two Arithmetic Progressions
省选/NOI-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given two arithmetic progressions: a_1_k + _b_1 and a_2_l + _b_2. Find the number of integers x such that L ≤ x ≤ R and x = a_1_k' + _b_1 = a_2_l' + _b_2, for some integers k', l' ≥ 0.
给你两个等差数列:a1k+b1 和 a2l+b2。求满足 L≤x≤R 且 x=a1k′+b1=a2l′+b2(其中 k′,l′≥0 为整数)的整数 x 的个数。
输入格式
The only line contains six integers _a_1, _b_1, _a_2, _b_2, L, R (0 < _a_1, _a_2 ≤ 2·109, - 2·109 ≤ _b_1, _b_2, L, R ≤ 2·109, L ≤ R).
唯一的一行包含六个整数 a1, b1, a2, b2, L, R(其中 0<a1, a2≤2⋅109,−2⋅109≤b1, b2, L, R≤2⋅109,且 L≤R)。
输出格式
Print the desired number of integers x.
输出所需数量的整数 x。
输入输出样例
输入#1
2 0 3 3 5 21
输出#1
3
输入#2
2 4 3 0 6 17
输出#2
2
输入解题思路,AI测评打分。不知道怎么写?