Petya and Divisors

题意翻译

## 题目描述 **Petya**喜欢寻找数字的因子。有一天他看到了这样的一条题目$:$ 有$n$个形如$[x,y]$的二元组,对于每一个二元组,**Petya**希望找到有多少个$x_i$的因子,使得在$[x_{i-y_i},x_{i-y_i+1},\cdots,x_{i-1}]$中的每一个数都不能整除它。帮帮他解决这个问题吧。 ## 输入输出格式 ### 输入格式 第一行有一个正整数$n$,满足$(1 \leq n\leq 10000)$ 下面有$n$行,每行$2$个非负整数$x_i$与$y_i(1 \leq x_i \leq 10^5 ,0 \leq y \leq i-1)$,意义如上文所述。 特别的,如果$y_i=0$,结果就是$x_i$因子的个数。 ### 输出格式 共$n$行,每行$1$个数,表示有多少个$k$,满足$[x_i $ $mod$ $k=0$并且$(\forall j:i-y_i \leq j < i) $ $mod$ $k \not = 0]$ ## 说明 样例一中前五个数的符合条件的因子如下: - $1)$ $1,2,4$ - $2)$ $3$ - $3)$ $5$ - $4)$ $2,6$ - $5)$ $9,18$

题目描述

Little Petya loves looking for numbers' divisors. One day Petya came across the following problem: You are given $ n $ queries in the form " $ x_{i} $ $ y_{i} $ ". For each query Petya should count how many divisors of number $ x_{i} $ divide none of the numbers $ x_{i-yi},x_{i-yi}+1,...,x_{i-1} $ . Help him.

输入输出格式

输入格式


The first line contains an integer $ n $ ( $ 1<=n<=10^{5} $ ). Each of the following $ n $ lines contain two space-separated integers $ x_{i} $ and $ y_{i} $ ( $ 1<=x_{i}<=10^{5} $ , $ 0<=y_{i}<=i-1 $ , where $ i $ is the query's ordinal number; the numeration starts with $ 1 $ ). If $ y_{i}=0 $ for the query, then the answer to the query will be the number of divisors of the number $ x_{i} $ . In this case you do not need to take the previous numbers $ x $ into consideration.

输出格式


For each query print the answer on a single line: the number of positive integers $ k $ such that ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF111B/e5195dc37be0c06af6e97f60e5c08b96dc97419b.png)

输入输出样例

输入样例 #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