303675: CF710D. Two Arithmetic Progressions
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Two Arithmetic Progressions
题意翻译
已知$x$ $mod$ $a_{1}=b_{1}$,$x$ $mod$ $a_{2}=b_{2}$,求在$[l,r]$之间有多少个解。题目描述
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 $ .输入输出格式
输入格式
The only line contains six integers $ a_{1},b_{1},a_{2},b_{2},L,R $ ( $ 0<a_{1},a_{2}<=2·10^{9},-2·10^{9}<=b_{1},b_{2},L,R<=2·10^{9},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