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 pZ喎?http://www.Bkjia.com/kf/ware/vc/" target="_blank" class="keylink">vc2l0aXZlIGludGVnZXIgdGhhdCBkaXZpZGVzIGFsbCA8ZW0+djwvZW0+PGVtPmk8L2VtPi48L3A+CgoKCklucHV0CjxwPgpUaGUgZmlyc3QgbGluZSBvZiB0aGUgaW5wdXQgY29udGFpbnMgaW50ZWdlciA8ZW0+bjwvZW0+LCAoMT+h3D88ZW0+bjwvZW0+P6HcPzEwNSksCiBkZW5vdGluZyB0aGUgbGVuZ3RoIG9mIHRoZSBzZXF1ZW5jZS4gVGhlIG5leHQgbGluZSBjb250YWlucyA8ZW0+bjwvZW0+IHNwYWNlIHNlcGFyYXRlZCBpbnRlZ2VycyA8ZW0+YTwvZW0+MSw/Li4uLD88ZW0+YTwvZW0+PGVtPm48L2VtPiwKICgxP6HcPzxlbT5hPC9lbT48ZW0+aTwvZW0+P6HcPzEwOSkuPC9wPgo8cD4KVGhlIHRoaXJkIGxpbmUgb2YgdGhlIGlucHV0IGNvbnRhaW5zIGludGVnZXIgPGVtPnE8L2VtPiwgKDE/odw/PGVtPnE8L2VtPj+h3D8zP6HBPzEwNSksCiBkZW5vdGluZyB0aGUgbnVtYmVyIG9mIHF1ZXJpZXMuIFRoZW4gZm9sbG93cyA8ZW0+cTwvZW0+IGxpbmVzLCBlYWNoIGNvbnRhaW4gYW4gaW50ZWdlciA8ZW0+eDwvZW0+PGVtPmk8L2VtPiwKICgxP6HcPzxlbT54PC9lbT48ZW0+aTwvZW0+P6HcPzEwOSkuPC9wPgoKCgpPdXRwdXQKPHA+CkZvciBlYWNoIHF1ZXJ5IHByaW50IHRoZSByZXN1bHQgaW4gYSBzZXBhcmF0ZSBsaW5lLjwvcD4KCgoKU2FtcGx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