It's mine:
#include <iostream>#include<cstring>using namespacestd;intx[100001],y[100001],d[100001];inti =1;intMain () {memset (d,-1,sizeof(d)); intN; CIN>>N; while(n--) { intAns =0, M; CIN>>x[i]>>Y[i]; for(intj =1; J*j <= X[i]; J + +) { if(X[i]%j = =0) {ans++; M=J; } } if(M * m = =X[i]) ans= ans*2-1; Elseans= ans*2; if(Y[i]) { for(intj =1; J*j <= X[i]; J + +) { if(X[i]% J = =0&& I-d[j] <=Y[i]) ans--; if(X[i]% (x[i]/j) = =0&& i-d[x[i]/j] <= y[i] && J! = x[i]/j) Ans--; } cout<<ans<<Endl; } Else if(Y[i] = =0) cout<<ans<<Endl; for(intj =1; J*j <= X[i]; J + +) { if(X[i]%j = =0) {D[j]=i; D[x[i]/j] =i; }} I++; }}
Someone else's:
/*#include <iostream> #include <stack> #include <queue> #include <stdio.h> #include < algorithm> #include <string.h> #include <cmath> #define LL long Long#define oo 1000000007#define maxn 100005using namespace Std;int last[maxn];int main () {int t,t; scanf ("%d", &t); Memset (Last,-1,sizeof (last)); for (t=1;t<=t;t++) {int x,y,ans,i; ans=0; scanf ("%d%d", &x,&y); for (i=1;i*i<=x;i++) if (x%i==0) {if (t-last[i]>y) ans++; if (x-i*i && t-last[x/i]>y) ans++; last[i]=last[x/i]=t; } printf ("%d\n", ans); } return 0;}*/#include<cstdio>#include<cstring>#defineN 100100intd[n],n,x,t;intMain () {memset (d,-1,sizeof(d)); scanf ("%d",&t); for(intidx=1; idx<=t;idx++) {scanf ("%d%d",&x,&N); intans=0; for(intI=1; i*i<=x;i++) { if((x%i) = =0) { intc1=i; intc2=x/i; //two approximate, I and x/i can be found at a time; if(D[C1]+N<IDX) ans++; if(c1!=c2 && D[c2]+n<idx) ans++; D[C1]=d[c2]=idx; }} printf ("%d\n", ans); } return 0;}
Codeforces 111B "Look at the gap between yourself and others in code capabilities! 】