CF111B.Petya and Divisors

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Little Petya loves looking for numbers' divisors. One day Petya came across the following problem:

You are given nn queries in the form " xix_{i} yiy_{i} ". For each query Petya should count how many divisors of number xix_{i} divide none of the numbers xiyi,xiyi+1,...,xi1x_{i-yi},x_{i-yi}+1,...,x_{i-1} . Help him.

输入格式

The first line contains an integer nn ( 1<=n<=1051<=n<=10^{5} ). Each of the following nn lines contain two space-separated integers xix_{i} and yiy_{i} ( 1<=xi<=1051<=x_{i}<=10^{5} , 0<=yi<=i10<=y_{i}<=i-1 , where ii is the query's ordinal number; the numeration starts with 11 ).

If yi=0y_{i}=0 for the query, then the answer to the query will be the number of divisors of the number xix_{i} . In this case you do not need to take the previous numbers xx into consideration.

输出格式

For each query print the answer on a single line: the number of positive integers kk such that

输入输出样例

  • 输入#1

    6
    4 0
    3 1
    5 2
    6 2
    18 4
    10000 3
    

    输出#1

    3
    1
    1
    2
    2
    22
    

说明/提示

Let's write out the divisors that give answers for the first 5 queries:

1) 1, 2, 4

2) 3

3) 5

4) 2, 6

5) 9, 18

首页