CF710D.Two Arithmetic Progressions
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given two arithmetic progressions: a1k+b1 and a2l+b2 . Find the number of integers x such that L<=x<=R and x=a1k′+b1=a2l′+b2 , for some integers k′,l′>=0 .
输入格式
The only line contains six integers 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 .
输入输出样例
输入#1
2 0 3 3 5 21
输出#1
3
输入#2
2 4 3 0 6 17
输出#2
2