fork download
  1. from math import gcd, ceil
  2.  
  3. t = int(input())
  4. while t>0:
  5. t-=1
  6. n = int(input())
  7. rebel = [int(i) for i in input().split(" ")]
  8. l, u = [int(i) for i in input().split(" ")] #army l u both inclusive
  9.  
  10. lcm = rebel[0]
  11. for i in rebel[1:]:
  12. lcm = lcm*i//gcd(lcm, i)
  13.  
  14. m = ceil(l/lcm)
  15. n = u//lcm
  16. ans = u-l+1-(n-m+1)
  17. # print(lcm, n, m, ans)
  18. print (ans if ans>0 else 0)
  19.  
  20.  
Success #stdin #stdout 0.01s 27704KB
stdin
1
1
2 3 4
10 12
stdout
2