Bayan 2015 Contest Warm Up D题(GCD)
来源:互联网 发布:轻兵器杂志 知乎 编辑:程序博客网 时间:2024/06/05 03:42
Given a sequence of integers a1, ..., an and q queries x1, ..., xq on it. For each query xi you have to count the number of pairs (l, r)such that 1 ≤ l ≤ r ≤ n and gcd(al, al + 1, ..., ar) = xi.
is a greatest common divisor of v1, v2, ..., vn, that is equal to a largest positive integer that divides all vi.
The first line of the input contains integer n, (1 ≤ n ≤ 105), denoting the length of the sequence. The next line contains n space separated integers a1, ..., an, (1 ≤ ai ≤ 109).
The third line of the input contains integer q, (1 ≤ q ≤ 3 × 105), denoting the number of queries. Then follows q lines, each contain an integer xi, (1 ≤ xi ≤ 109).
For each query print the result in a separate line.
32 6 3512346
12201
710 20 3 15 1000 60 16101234561020601000
14022202211
- Bayan 2015 Contest Warm Up D题(GCD)
- Bayan 2015 Contest Warm Up (D题)
- map+pair Bayan 2015 Contest Warm Up D题
- Bayan 2015 Contest Warm Up
- Bayan 2015 Contest Warm Up
- codeforce Bayan 2015 Contest Warm Up D CGCDSSQ
- Bayan 2015 Contest Warm Up D. CGCDSSQ (数论)
- Bayan 2015 Contest Warm Up(C,D)
- Bayan 2015 Contest Warm Up C题(DP+模拟)
- CF Bayan 2015 Contest Warm Up A.(模拟+预处理)
- CF Bayan 2015 Contest Warm Up B.(dfs+暴力)
- CODEFORCES Bayan 2015 Contest Warm Up A题= =WA啦!~~!!!
- CF Bayan 2015 Contest Warm Up B题 Strongly Connected City
- Bayan 2015 Contest Warm Up E题(双连通分量缩点+DP计数)
- CF Bayan 2015 Contest Warm Up B. Kamal-ol-molk's Painting
- D - Warm up 2
- 2015 HNU Warm Up 01
- 2015 HNU warm up 02
- 通过重写ViewGroup学习onMeasure()和onLayout()方法
- HDU 1166 敌兵布阵 (线段树 & 树状数组)
- 治疗蛔虫病
- UVA - 10591 Happy Number
- UNIX网络编程简单练习
- Bayan 2015 Contest Warm Up D题(GCD)
- 螺旋数组的打印系列汇总
- Watch Out!(中文名:贱鸟跳跳)
- 我读过的最好的epoll讲解
- javascript 正则表达式验证身份证号码
- TCP 的那些事儿(上)
- TCP 的那些事儿(下)
- Python SocketServer
- 单链表多项式相加