label
stringlengths 1
2
| index
stringlengths 1
5
| code
stringlengths 87
8.24k
|
---|---|---|
1 | 300 | //????????
//??????
int f(int a,int m) //???a???????m?????????
{
if(a<m)
return 0;
int kind=1;
for(int i=m;i<a;i++)
{
if(a%i==0) //??????????????
kind=kind+f(a/i,i);
}
return kind;
}
int main()
{
int n,a[100];
cin>>n;
for(int i=0;i<n;i++) //??n???
cin>>a[i];
for(int i=0;i<n;i++)
cout<<f(a[i],2)<<endl; //????
return 0;
}
|
1 | 301 | /*
* huisu.cpp
* ????
* Created on: 2010-11-26
* Author: ???
*/
int a=0,i=0,sum=1; //sum?????????????????????????1
void f(int i,int a) { //f????????
int j;
for(j=i;j<=sqrt(a);j++)
if(a%j==0) {sum++; f(j,a/j);} //?a??j?????????1????????????,????
} //???j??????????????3*13?13*3
int main(){
int n;
cin>>n;
while (n){
cin>>a;
f(2,a);
cout<<sum<<endl;
n--;
sum=1; //??sum
}
}
|
1 | 302 | int main()
{
int n, t;
cin >> n;
for(t = 0;t < n;t++)
{
int m;
cin >> m;
int f(int a,int min);
cout << f(m, 2) << endl;
}
return 0;
}
int f(int a, int min)
{
int i = min;
if(a < min)
{
return 0;
}
int result = 1;
while(i < a)
{
if(a % i == 0)
{
result += f(a / i,i);
}
i++;
}
return result;
}
|
1 | 303 |
int f(int a,int x)
{
int count=1,i;
for(i=x;i<a;i++)
if(a%i==0)
count+=f(a/i,i);
if(i==a)
return count;
else
return 0;
}
void main()
{
int n,a;
scanf("%d",&n);
for(;n>0;n--)
{
scanf("%d",&a);
if(a==1||a==2)
printf("1\n");
else
printf("%d\n",f(a,2));
}
}
|
1 | 304 | int i,n,k;
int work(int p,int n)
{
if (n==1) k++;
for (int i=p;i<=n;i++)
if (n%i==0) work(i,n/i);
}
int main()
{
int m;
cin>>m;
while (m>0)
{
cin>>n;
k=0;
work(2,n);
cout<<k<<endl;
m--;
}
return 0;
}
|
1 | 305 | int Factorization(int,int);
int main()
{
int n=0,num=0;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>num;
cout<<Factorization(num,2)+1<<endl;
}
return 0;
}
int Factorization(int num,int n)
{
int count=0;
for(int i=n;num/i>=i;i++)
if(num%i==0)
{
count++;
count=count+Factorization(num/i,i);
}
return count;
}
|
1 | 306 | int fenjie(int ,int );
int main()
{
int i,n,t,r,num;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>num;
r=fenjie(num,2);
cout<<r<<endl;
}
return 0;
}
int fenjie(int num,int min)
{
int i,j,k,r=0;
for(i=min;i<=num;i++)
{
if(num%i==0)
{
r=r+fenjie(num/i,i);
}
if(i==num) r++;
}
return r;
} |
1 | 307 | //*****************************************************
//*?????????.cpp *
//*?????? *
//*?????2010?12?8? *
//*???????????????? *
//*****************************************************
int answer=0;//???????
int a=2;//???2????
void f(int,int);//?????
int main()//???
{
int n=0;
int i=0;
int data[100]={0};
cin>>n;//????
for(i=0;i<n;i++)
{
cin>>data[i];
}
for(i=0;i<n;i++)
{
f(data[i],a);
cout<<answer<<endl;
answer=0;//??
}
}
void f(int m,int n)//???
{
int i=0;
if(m==1)//??????1 ?????????
{
answer=answer+1;
}
for(i=n;i<=m;i++)//???2?????
{
if(m%i==0)
{
f(m/i,i);
}
}
} |
1 | 308 | /*
* 1090 ????.cpp
*
* Created on: 2010-11-26
* Author: ???
*/
int f(int a,int min) //???a???????min??????
{
int j,num; //j????num????
if (a<min) return 0; //??a??min?????????????
num=1; //???????
for (j=min;j<a;j++) //????????
if (a%j==0) num=num+f(a/j,j); //???????????
return num; //????
}
int main()
{
int n,i,out,a; //n???????out???????a??????
cin>>n;
for (i=0;i<n;i++)
{
cin>>a;
out=f(a,2); //??????
cout<<out<<endl;
}
return 0;
} |
1 | 309 | /*
*????111120 04.cpp
*??????
*?????2011-11-22
*?????????????
*/
int g=0; //?????????
void s(int n,int z) //????
{
for(int i=2;i<=sqrt(n);i++) //????????????
{
if(n%i==0&&i>=z)
{
g=g+1;
s(n/i,i);
}
}
}
int main() //???
{
int a,b;
cin>>a; //????
while(cin>>b) //??????
{
for(int j=2;j<=sqrt(b);j++) //????????????
{
if(b%j==0)
{
g=g+1;
s(b/j,j); //??????
}
}
cout<<g+1<<endl; //???
g=0; //????
}
return 0; //??
} |
1 | 310 | int f(int n,int m)
{
int sum=1,i;
if(n<m)
sum=0;
else
if(n==m)
sum=1;
else
{
for(i=m;i<=n;i++)
if(n%i==0)
sum=sum+f(n/i,i);
}
return(sum);
}
void main()
{
int x,j,a[100000];
scanf("%d",&x);
for(j=0;j<x;j++)
scanf("%d",&a[j]);
for(j=0;j<x;j++)
printf("%d\n",f(a[j],2));
}
|
1 | 311 | int turn(int a,int b)
{
int i,k;
if(a==1) k=1;
else if(a<b) k=0;
else
{
k=0;
for(i=b;i<=a;i++)
if(a%i==0)
k=k+turn(a/i,i);
}
return k;
}
int main()
{
int n,i,a[1000],t;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
t=turn(a[i],2);
printf("%d\n",t);
}
return 0;
} |
1 | 312 | int times;
void fenjie(int m,int k)
{
int i;
{
for(i=k;i<=sqrt(m);i++)
{
if(m%i==0)
{
fenjie(m/i,i);
}
}
}
times++;
}
int main()
{
int n,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
int m;
times=0;
scanf("%d",&m);
fenjie(m,2);
printf("%d\n",times);
}
} |
1 | 313 | int ways(int, int);
void main()
{
int ways(int a, int min);
int n,b;
scanf("%d",&n);
while(n-->0)
{
scanf("%d",&b);
printf("%d\n",ways(b,2));
}
}
int ways(int a, int min)
{
if(a<min) return 0;
int sum=0, i;
for(i=min;i<=sqrt(a*1.0);i++)
{
if(a%i == 0)
sum = sum + ways(a/i, i);
}
return sum+1;
} |
1 | 314 | int main()
{
int brea(int a,int min);
int i,n,a;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a);
printf("%d\n",brea(a,2));
}
}
int brea(int a,int min)
{
int result=1;
int i;
if(a<min)
return(0);
else if(a==min)
return(1);
else
{
for(i=min;i<a;i++)
{
if(a%i==0)
{
result=result+brea(a/i,i);
}
}
return(result);
}
} |
1 | 315 |
int f2(int i,int a)
{
int c,s=0;
for(i;i<=a/2;i++)
{
if(a%i==0)
{
c=a/i;
if(c>=i)
{
s=s+f2(i,c);
}
}
}
s=s+1;
return s;
}
int f(int a)
{
int s=0;
s=s+f2(2,a);
return s;
}
int main()
{
int n,i,a,b;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a);
b=f(a);
printf("%d\n",b);
}
return 0;
} |
1 | 316 | int Factor(int, int);
int main()
{
int n, a, i;
scanf("%d",&n);
for (i = 1;i <= n;i++)
{
scanf("%d",&a);
printf("%d\n",Factor(a, 2));
}
return 0;
}
int Factor(int a,int p)
{
int i, j, z = 1;
if (a < p)
z = 0;
else
{
for (i = p;i <= a;i++)
{
if (a % i == 0)
{
z += Factor(a / i, i);
}
}
}
return z;
} |
1 | 317 | int fenjie(int max,int min)
{
int num=1,i,k;
for(i=min;i<max/2;i++)
{
k=max%i;
if(k==0)
{
if(i<=max/i)
num+=fenjie(max/i,i);
}
}
return num;
}
int main()
{
int a[10000],n,j;
scanf("%d",&n);
for(j=0;j<n;j++)
{
scanf("\n%d",&a[j]);
}
for(j=0;j<n;j++)
{
printf("%d\n",fenjie(a[j],2));
}
return 0;
} |
1 | 318 | int sum=0;
void f(int n,int y)
{
int a=sqrt(n);
for(int i=y;i<=a;i++)
{
if(n%i==0)
{
sum++;
y=i;
f(n/i,y);
}
}
}
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
int num;
cin>>num;
sum=0;
f(num,2);
cout<<sum+1<<endl;
}
return 0;
} |
1 | 319 |
int divmet(int n,int i);
int main()
{
int n=0; //?????
int t=0; //????
int sum; //???????
cin>>t;
for(int i=0;i<t;i++)
{
sum=0;
cin>>n;
for(int j=2;j<=n;j++)
{
sum=sum+divmet(n,j);
}
cout<<sum<<endl;
}
return 0;
}
int divmet(int n,int i)
{
int num=0;
if(n%i==0)
{
if(n==i)
{
return 1;
}
for(int j=2;j<=i;j++)
{
num=num+divmet(n/i,j); //??
}
return num;
}
else
{
return 0;
}
}
|
1 | 320 | /*
*?????
*???2010 - 12 - 07
*????????? ????
*/
int num(int,int,int);
int qufen(int);
int power(int,int);
int main()
{
int t;
cin >> t;
while(t >= 1)
{
int n,i,x,sum = 1;
cin >> n;
x = qufen(n); //qufen????????????????????
for(i = 2; i <= x; i++)
sum = sum + num(n,i,2); //num?????????????i????????
cout << sum << endl;
t--;
}
return 0;
}
int qufen(int n)
{
int j;
for(j = 1; ; j++)
{
if(power(2,j) > n)
{
return j - 1;
break;
}
}
}
int power(int a,int b)
{
int sum = 1,k;
for(k = 1; k <= b; k++) //?????????
sum = sum * a;
return sum;
}
int num(int n,int g,int h)
{
if((g == 1)&&(n >= h)) //???????
return 1;
int i,j = 0,count = 0,a[20000];
for(i = h; i < n; i++) //???????????? n ?? i ?? g ??????n / i????? g - 1?
{ //?n = i *
?g?? ???? n / i = h *
(g - 1 ???h??????i???
if(n % i == 0)
{
a[j] = i;
j++;
}
}
if(j == 0) //j == 0?????????????????
return 0;
else
{
for(i = 0; i < j; i++)
count = count + num(n / a[i],g - 1,a[i]);
return count;
}
} |
1 | 321 | int fj(int a,int zs){
int k,n,z;
n=0;z=0;
for(k=zs;k<=sqrt(a);k++){
if(a%k==0){n=n+fj(a/k,k);
z=1;}
}
if(z==0){return 1;}
else{return n+1;}
}
int main(){
int m,i,t;
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d",&t);
printf("%d\n",fj(t,2));
}
return 0;
}
|
1 | 322 | int main()
{
int fun(int m,int n);
int n,i,sum;
scanf("%d",&n);
int *p;
p=(int *)malloc(sizeof(int)*n);
for(i=0;i<n;i++)
scanf("%d",&p[i]);
for(i=0;i<n;i++)
{
sum=0;
sum=fun(p[i],1);
printf("%d\n",sum);
}
free(p);
}
int fun(int m,int n)
{
int i,sum=1;
if(n==1)
{
for(i=2;i*i<=m;i++)
{
if(m%i==0)
sum=sum+fun(m/i,i);
}
}
else
{
for(i=n;i*i<=m;i++)
{
if(m%i==0)
sum=sum+fun(m/i,i);
}
}
return sum;
} |
1 | 323 | int fenjie(int x,int p);
int N;
int main()
{
int n,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{scanf("%d",&N);
printf("%d\n",fenjie(N,2));
}
return 0;
}
int fenjie(int x,int p)
{
int f=0;
if(x==1)
return 1;
else
{for(int i=p;i<=x;i++)
if(x%i==0)
f=f+fenjie(x/i,i);
}
return f;
} |
1 | 324 | int yinshu(int num,int min);
int main(){
int n,i;
scanf("%d",&n);
for(i=0;i<n;i++){
int a,result;
scanf("%d",&a);
result=yinshu(a,2)+1;
printf("%d\n",result);
}
return 0;
}
int yinshu(int num,int min){
int r,x=0;
if(num<min){
return 0;
}
else{
for(r=min;r*r<=num;r++){
if(num%r==0){
x=x+1+yinshu(num/r,r);
}
}
return x;
}} |
1 | 325 | /**
* @file homework.cpp
* @author ??
* @date 2010?12?03
* @description
* ??????: 1090 ????
*/
void jisuan(int ,int);
int times, sum, i, n;
int main()
{
cin >> times;
for (i=0;i<times;i++)
{
sum = 0;
cin >> n;
jisuan (n, 2);
cout << sum << endl;
}
return 0;
}
void jisuan(int n, int j)
{
int i;
for (i=j;i<=n;i++)
{
if (n > 1)
{
if (n % i == 0)
{
if (n % i != 0 && n > i)
sum++;
jisuan (n / i, i);
}
}
if (n == i)
sum ++;
}
}
|
1 | 326 | int f(int a,int b);
int main()
{
int n,c[100],i,a,sum;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&c[i]);
}
for(i=1;i<=n;i++)
{
a=c[i];
sum=f(a,2);
printf("%d\n",sum);
}
return 0;
}
int f(int a,int b)
{
int sum=1;
int i;
if(a<b)
return 0;
for(i=b;i<a;i++)
{
if(a%i!=0)
continue;
else
sum=sum+f(a/i,i);
}
return sum;
}
|
1 | 327 | int f(int n,int k){
if(n<k)return 0;
int i,s=1;
for(i=k;i<n;i++){
if(n%i==0)s+=f(n/i,i);
}
return s;
}
int main(){
int m,n,i,ans,s;
scanf("%d",&m);
while(m--){
scanf("%d",&n);
printf("%d\n",f(n,2));
}
return 0;
} |
1 | 328 | int divide(int a,int b)
{
int i,r;
r=1;
for(i=b;i<a;i++)
{
if(((a/i)*i)==a&&(a/i)>=i) r=r+divide(a/i,i);
}
return r;
}
int main()
{
int s,p,n,j;
scanf("%d",&n);
for(j=0;j<n;j++)
{
scanf("%d",&p);
s=divide(p,2);
printf("%d\n",s);
}
} |
1 | 329 | /*
* 1.cpp
*
* Created on: 2010-12-1
* Author: hanzhe
*/
int min(int a,int b){ //????
if(a>b)return b;
else return a;
}
int f(int n,int s){ //???????s?n???????
int k=0,i;
if(n==1)return 1;
else if(s==1)return 0;
else if(s>n)return f(n,n);
else {for(i=2;i<=s;i++)
if(n%i==0)k=k+f(n/i,min(i,s));
return k;
}
}
int main(){ //????
int n,m;
cin>>n;
while(n>0){
cin>>m;
cout<<f(m,m)<<endl; //??
n--;
}
return 0;
} //????
|
1 | 330 | int f(int x,int y)
{
int s=0,i;
for(i=y;i>1;i--)//???????????
{
if(x%i==0)
s+=f(x/i,i);//i?x/i????????1
}
if(x==1)
return 1;
return s;
}
int main()
{
int n,i,a[50];
cin>>n;
for(i=1;i<=n;i++)
cin>>a[i];
for(i=1;i<=n;i++)
cout<<f(a[i],a[i])<<endl;
return 0;
} |
1 | 331 | int f(int x,int y){//x??????y????????
if((int)pow(x,0.5)<y)return 1;//??x^0.5???y??1
int d=1;
for(int i=y;i<=(int)pow(x,0.5);i++)//??i<=x^0.5,??????
if((x%i)==0)
d+=f(x/i,i);//??
return d;
}
int main(){
int n,m;
cin>>n;//??
for(int k=1;k<=n;k++){
cin>>m;
cout<<f(m,2)<<endl;//????
}
return 0;
} |
1 | 332 | /*
* 1118-4.cpp
*
* Created on: 2011-11-29
* Author: Administrator
*/
int divide(int n,int a){
int s=0,t=0,i;
if(n==1) return 1;
for(i=a;i>1;i--)
if(n%i==0){
s+=divide(n/i,i);
t++;
}
if(t==0) return 0;
return s;
}
int main(){
int n,k;
cin>>k;
while(k>0){
cin>>n;
cout<<divide(n,n)<<endl;
k--;
}
return 0;
}
|
1 | 333 | int main()
{
int f(int,int);
int n,a;
cin>>n;
while(n--)
{
cin>>a;
cout<<f(a,a)<<endl;
}
return 0;
}
int f(int m,int k)
{
int i,sum=0;
if(m==1) sum=1;
for(i=m;i>1;i--)
{
if(m%i==0&&i<=k)
sum+=f(m/i,i);}
return sum;
} |
1 | 334 | int f(int a,int min)
{
if(a<min)
{
return 0;
}
int result=1,i;
for(i=min;i<a;i++)
{
if(a%i==0)
{
result+=f(a/i,i);
}
}
return (result);
}
int main()
{
int n,a[100],b[100],i;
scanf("%d\n",&n);
for(i=0;i<n;i++)
{
scanf("%d\n",&a[i]);
}
for(i=0;i<n;i++)
{
b[i]=f(a[i],2);
}
for(i=0;i<n;i++)
{printf("%d\n",b[i]);}
return 0;
}
|
1 | 335 | int b[40000]={0};
void zhishu(int n)
{
int i,j;
for(i=2;i<sqrt(n);i++)
{
for (j=2;j<n/i+1;j++)
{
b[i*j]=1;
}
}
}
int fenjie(int n,int m)
{
int s=0,i;
if (n<m) return 0;
if (n==m||b[n]==0) return 1;
for (i=m;i<n;i++)
{
if (n%i==0)
{
s=s+fenjie(n/i,i);
}
}
return s+1;
}
int main()
{
int n,i,max=0,a[1000];
cin>>n;
for (i=0;i<n;i++)
{
cin>>a[i];
if (a[i]>max) max=a[i];
}
zhishu(max);
for (i=0;i<n;i++) cout<<fenjie(a[i],2)<<endl;
return 0;
}
|
1 | 336 | int sum=1 ;
int kk(int a,int b)
{
int i;
for(i=b;i>=2;i--)
if(a%i==0)
return a/i;
return 0;
}
int seperate(int a,int b)
{
int i;
for(i=b;i>=2;i--)
{
if(a%i==0&&(a/i)<=i)
{sum++;if((a/i)==2)continue;else seperate(a/i,a/i-1);}
else if((a%i==0)&&((kk(a/i,i))!=0))
{
seperate(a/i,i);
}
}
return sum;
}
int main()
{
int n,i,m;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>m;
cout<<seperate(m,m-1)<<endl;
sum=1;
}
return 0;
}
|
1 | 337 |
int main()
{
int n,i;
int a,num(int,int);
cin>>n;
for (i=0;i<n;i++)
{
cin>>a;
cout<<num(2,a)+1<<endl;
}
return 0;
}
int num(int m,int n)
{
int i,count=0;
int su(int);
for (i=m;i<=(int)sqrt(n);i++)
if (n%i==0)
{
count++;
if (su(n/i)!=0)
count+=num(i,n/i);
}
return count;
}
int su(int n)
{
int i;
for (i=2;i<n;i++)
if (n%i==0)
{
return 1;
break;
}
if (i==n)
return 0;
} |
1 | 338 |
int digui(int m,int n,int sum)
{
int i;
sum++;
if(sqrt(m)<n)
return sum;
else{
for(i=n;i<=sqrt(m);i++){
if(m%i==0)
sum=digui(m/i,i,sum);
}
return sum;
}
}
void main()
{
int n,a;
scanf("%d",&n);
while(n--){
scanf("%d",&a);
printf("%d\n",digui(a,2,0));
}
} |
1 | 339 | int minf(int p,int min);
int main(){
int n,i,k,p,zs[20000]={0};
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&p);
//for(min=2;min<=(int)sqrt(p);min++){
//if(p%min==0){
zs[i]=minf(p,2);
//printf("%d\n",minf(p,min));
// }
//}
zs[i]++;
}
for(i=0;i<n-1;i++){
printf("%d\n",zs[i]);
}
printf("%d",zs[n-1]);
//scanf("%d",&n);
return 0;
}
int minf(int p, int min){
int x=0,i;
i=min;
for(i;i<=(int)sqrt(p);i++){
if(p%i==0){
x+=minf(p/i,i)+1;
}
}
return x;
} |
1 | 340 |
int Factorization(int n,int k){ //????????
int sum=0; //??????sum??????????
if (n<k){ //?????????k
return 0; //??0
}
if (n%k==0){ //????????k???
if (n==k){ //?n?k???
return 1; //??1
}
else{
sum=sum+Factorization(n,k+1)+Factorization(n/k,k); //??????????
}
}
else{
sum=sum+Factorization(n,k+1); //?????????k????????
}
return sum; //??sum??
}
int main(){
int t,i,a; //???????t???????i??????a???????
cin>>t; //????????
for (i=1;i<=t;i++){ //?????????
cin>>a;
cout<<Factorization(a,2)<<endl;
}
return 0;
}
|
1 | 341 | int t, a, flag, a1;
/*bool prime(int k)
{
int j, sqrt_k;
if (k == 2)
return 1;
else
{
sqrt_k = sqrt((double)k);
for (j = 2; j <= sqrt_k; j++)
{
if (k % (int)j == 0)
break;
}
if (j == sqrt_k + 1)
return 1;
else
return 0;
}
}
/*
void find(int m)
{
int i;
if (prime(m))
{
flag = 1;
t++;
// cout << t << endl;
return;
}
for (i = 2; i <= sqrt((double) m); i++)
{
if ((m % i == 0) && (a1 <= i))
{
// cout << a1 << 2<< endl;
//cout << i << " " << 1 <<endl;
a1 = i;
//if (!prime(m / i))
t++;
// cout << t << endl;
find(m / i);
}
}
return;
}*/
void find(int m, int min)
{
int i;
//int a[];
for (i = 2; i <= sqrt((double)m); i++)
{
if (m % i == 0)
{
if (i >= min)
//if (a1 >= i)
{
t++;
// if (!/*((m / i > i) && */(prime(m / i)))
// cout << t << " ";
// cout <<i<<" " << m / i << " " << t <<endl;
// t++;
// cout << " " << a1 <<endl;
//cout << t<<endl;
// a1 = i;
min = i;
//cout << min << endl;
find(m / i, min);
}
}
}
/*if (i == (int)sqrt((double)m) - 1)
return;*/
return;
}
int main()
{
int n, ii;
cin >> n;
for (ii = 1; ii <= n; ii++)
{
t = 0;
flag = 0;
cin >> a;
// if (prime(a)) t--;
a1 = a;
find(a, 2);
cout << t + 1<< endl;
}
return 0;
} |
1 | 342 |
int num;
int wrh(int n,int r,int b[200],int y,int a)
{
int i;
for( i = y;i <= a/2;i ++ )
{
if ( r % i == 0)
{
b[n] = i;
int now = 1,j;
for ( j = 1;j <= n;j ++ )
now = now * b[j];
if ( now == a)
{
num ++;
break;
}
if ( now > a) break;
else
wrh(n + 1,r / i,b,i,a);
}
}
return 0;
}
int main()
{
int s,a,b[200];
cin >> s;
while (s > 0)
{
num = 0;
cin >> a;
wrh(1,a,b,2,a);
cout << num + 1<<endl;
s --;
}
return 0;
}
|
1 | 343 | int prime(int min,int num)
{
int i;
for(i=min;i<num;i++)
{
if(num%i==0)
return 0;
}
return 1;
}
int count(int min,int num)
{
int i=0,n=1;
if(prime(min,num))
return 1;
else
for(i=min;i<num;i++)
{
if(num%i==0&&i<=num/i)
{
n=n+count(i,num/i);
}
}
return n;
}
int main()
{
int num,n,i;
cin>>n;
for(i=0;i<n;i++)
{
cin>>num;
cout<<count(2,num)<<endl;
}
return 0;
}
|
1 | 344 | int f(int num,int i)
{
int sum;
sum=0;
int j;
for(j=i;j<=num/2;j++)
{
if(num%j==0)
{
if(num/j<j)
{
sum=sum;
}else{
sum=1+sum+f(num/j,j);
}
}
}
return sum;
}
int main()
{
int n,num,i;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&num);
int j,sum;
sum=0;
j=2;
sum+=f(num,j);
printf("%d\n",sum+1);
}
return 0;
} |
1 | 345 | int f(int a,int x)
{
int i,j;
if(x==2)
return 1;
else
{
int result=1;
for(i=a;i<=x;i++)
if(x%i==0&&x/i>=i)
result=result+f(i,x/i);
return result;
}
}
main()
{
int i,j,k;
int n;
scanf("%d",&n);
for(i=0;i<n;i++)
{
int a;
scanf("%d",&a);
printf("%d\n",f(2,a));
}
}
|
1 | 346 | /*
* 1000012739_34_1.cpp
*
* Created on: 2010-12-3
* Author: ???
* Title: 1090 ????
*/
int cnt=0; //????????
void slv(int nm,int pr) //nm????????pr???????
{
int i;
if (nm>=pr) //???????????
{
cnt++; //??????
if (pr==1) //???????????2??
pr++;
for (i=pr;i<=nm;i++) //??????
{
if (nm%i==0) //??nm???
{
slv(nm/i,i); //nm??i???
}
}
}
}
int main()
{
int n,i,num;
cin>>n; //??????
for (i=1;i<=n;i++)
{
cnt=0; //???????
cin>>num; //????
slv(num,1); //??cnt
cout<<cnt<<endl; //??cnt
}
} |
1 | 347 | //============================================================================
// Name : 9.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
int sum=0;//????sum
void devide(int a,int b)//??
{
if(a==1)
sum++;
else
{
if(a>=b)
devide(a,b+1);
if(a%b==0)
devide(a/b,b);
}
}
int main()//???
{
int n,a;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a;
sum=0;
devide(a,2);
cout<<sum<<endl;
}
return 0;
}
|
1 | 348 | //**********************
//* ??? ???? *
//* 1200012878 ??? *
//* 12?1? *
//**********************
int fengjie(int a, int b)
{
if (a ==2 || a == 3)
return 1;
int sum = 1;
int c = sqrt(a);
for (int i = b; i <= c; i++)
{
if (a % i == 0)
{
sum = sum + fengjie(a / i, i);
}
}
return sum;
}
int main()
{
int n, a;
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> a;
cout << fengjie(a, 2) << endl;
}
return 0;
}
|
1 | 349 | //
// main.cpp
// ?????
//
// Created by ???? on 13-11-22.
// Copyright (c) 2013? ????. All rights reserved.
//
int f(int a,int s)//s for start
{
if(a<=s) return 1;
int b=sqrt((float)a),flag=0,sum=1;
for(int i=s;i<=b;i++)
{
if(a%i==0)
{
flag++;
sum=sum+f(a/i,i);
}
}
if(flag==0) return 1;
else return sum;
}
int main()
{
int a,n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a;
cout<<f(a,2)<<endl;
}
return 0;
}
|
1 | 350 | //????????
int kind(int num,int min); //????kind???num???????min?????????
int main() //?????
{
int n;
int i;
int num;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>num; //??????n????????????????????
cout<<kind(num,2)<<endl;
}
return 0;
} //?????
int kind(int num,int min) //kind????
{
if(num<min) //??num??min??????????min?????????0
{return 0;}
int k=1; //????????num=num??????????
int i;
for(i=min;i<=num;i++)
{
if(num%i==0) //??????
{
k=k+kind(num/i,i); //?k????num?????i???????????????????????????????min?
}
}
return k; //?????k
}
|
1 | 351 | int a[40000]={0};
void fun(int n,int j,int k){
int i;
for(i=j;i<=sqrt(n);i++){
if(n%i==0){
j=i;
a[k]++;
fun(n/i,j,k);
}
}
}
int main()
{
int n;
int m[40000]={0};
int i;
scanf("%d",&n);
for(i=1;i<=n;i++){ scanf("%d",&m[i]);}
for(i=1;i<=n;i++){fun(m[i],2,i);}
for(i=1;i<=n;i++){ printf("%d\n",a[i]+1);}
return 0;
}
|
1 | 352 | int sum=0;
void f(int x, int i)
{
double m=sqrt(x);
if(i<m)
{
if(x%i==0)
{
sum++;
f(x/i,i);
}
f(x,i+1);
}
if(fabs(i-m)<0.00000001)
sum++;
}
int main()
{
int x,i,n;
scanf("%d",&n);
for(i=0;i<n;i++)
{scanf("%d",&x);
sum=0;
f(x,2);
printf("%d\n",sum+1);
}
return 0;
}
|
1 | 353 | int f(int n, int min){
int i, result=1;
if(min>n)
return 0;
for(i=min;i<n;i++){
if(n%i==0){
result+=f(n/i,i);
}
}
return result;
}
int main(){
int n,a,i,t;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a);
t=f(a,2);
if(i<n-1)
printf("%d\n",t);
else
printf("%d",t);
}
return 0;
} |
1 | 354 | int number=0;
int main()
{
void f(int first,int m);
int n,i,num;
cin>>n;
for(i=0;i<n;i++)
{
cin>>num;
f(2,num);
cout<<number/2<<endl;
number=0;
}
return 0;
}
void f(int first,int m)
{
int i;
for(i=first;i<=m;i++)
{
if(m%i==0)
{
m=m/i;
f(i,m);
if(m!=1)
m=m*i;
}
}
if(m==1)
number+=1;
}
|
1 | 355 |
int c = 1;
void fenjie(int a, int k)
{
if (a == 1)
{
c++;
return;
}
for (int i = k; i <= a; i++)
{
if (a % i == 0)
{
fenjie(a / i, i);
}
}
}
int main()
{
int n, a;
cin >> n;
while (n--)
{
c = 0;
cin >> a;
fenjie(a, 2);
cout << c << endl;
}
return 0;
}
|
1 | 356 | /*
* 2.cpp
*
* Created on: 2012-9-14
* Author: 12006
*/
int tmp = 2 ;
int suml(int n,int tmp) //??????
{
int sum = 0 ;
if(n==1)
{
return 1 ;
}
for(int i = tmp ; i <=n ; i++)
{
if(n%i==0)
{
sum+=suml(n/i,i);
}
}
return sum ;
}
int main()
{
int m ;
cin >> m ;
int n ;
for(int i = 0 ; i < m ; i++)
{
cin >> n ;
int zon_shu = 0 ;
zon_shu = suml(n,tmp) ;
cout << zon_shu <<endl ;
}
}
|
1 | 357 | int f(int a,int s)
{
int y=0;
for (;s<=a;s++)
{
if (s==a)
y+=1;
else if (s>1&&a%s==0)
y+=f(a/s,s);
}
return y;
}
main ()
{
int n,i,a;
scanf ("%d",&n);
for (i=0;i<n;i++)
{
scanf ("%d",&a);
printf ("%d\n",f(a,1));
}
} |
1 | 358 | int main(){
int hanshu(int k,int min);
int n,i,a;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a);
printf("%d\n",hanshu(a,2));
}
scanf("%d",&n);
return 0;
}
int hanshu(int k,int min){
int j,a[k],b=1;
if(k<min)return 0;
for(j=min;j<=k/j;j++){
if(k%j==0){
b+=hanshu(k/j,j);
}
}
return(b);
}
|
1 | 359 | int t;
void calc(int a,int d)
{
int i;
if (a==1) t++;
else{
if (a>=d)
for (i=d;i<=a;i++)
if (a%i==0)
calc(a/i,i);}
}
void main()
{
int n,i,a;
scanf("%d",&n);
for (i=1;i<=n;i++)
{
scanf("%d",&a);
t=0;
calc(a,2);
printf("%d\n",t);
}
} |
1 | 360 |
int factor(int a,int min){
int i,result=1;
if(a<min) return 0;
for(i=min;i<a;i++){
if(a%i==0)
result+=factor(a/i,i);
}
return result;
}
int main(){
int n,i,a[100];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
a[i]=factor(a[i],2);
}
for(i=0;i<n;i++){
if(i==n-1) printf("%d",a[i]);
else printf("%d\n",a[i]);
}
return 0;
} |
1 | 361 | int f(int a,int min);//???a???????min?????????
int f(int a,int min)
{
if(a < min){
return 0;
}
int result = 1;
for(int i = min;i*i<=a;i++){
if(a % i == 0){
result += f(a/i,i);//???? ??????????a/i?i????????i???????
}
}
return result;
}
int main(){
int n,k;
cin>>n;
while(n>0)
{
cin>>k;
cout<<f(k,2)<<endl;//????
n--;
}
}
|
1 | 362 | void factor(int,int);
int result[9999]={0};
int j=0;
int main()
{
int times,k=1;
cin>>times;
while(k<=times){
int num,ansf=0;
cin>>num;
factor(2,num);
for(int i=0;i<9999;i++)
if(result[i])ansf++;
cout<<ansf<<endl;
for(int i=0;i<9999;i++)
result[i]=0;
k++;
}
return 0;
}
void factor(int start,int num)
{
if(num==1)
{result[j]=1;j++;}
for(int i=start;i<=num;i++){
if(num%i==0)
factor(i,num/i);
}
}
|
1 | 363 |
int devide(int n,int m)
{
if(n<m)
m=n;
if(n==1)//?????1?,??1
return 1;
int sum=0;
for(int i=m;i>=2;i--)
{
if(n%i==0)
{
sum=sum+devide(n/i,i);
}
}
return sum;
}
int main()
{
int n,i,m;
cin>>n;
i=0;
while ( i<n )
{
cin>>m;
cout<<devide (m,m)<<endl;//???????
i++;
}
return 0;
} |
1 | 364 | int a[1000];
int l=0,x;
int fff(int w,int t);
int main()
{
int i,j,q,p,n,m,y;
scanf("%d",&n);
for(p=0;p<n;p++)
{q=1;l=0;
scanf("%d",&x);
for(i=2;i<=x;i++)
if(x%i==0)
{a[q]=i;
q++;
}
fff(q-1,1);
printf("%d\n",l);
}
}
int fff(int w,int t)
{
int i,j,y,n,m,p;
for(i=t;i<=w;i++)
{if(x%a[i]==0)
{x=x/a[i];
if(x==1){l++;}
if(x>1)
fff(w,i);
x=x*a[i];
}
}
}
|
1 | 365 | int f(int x,int y)
{
int a,n=0;
for(a=y;a<=sqrt(x);a++)
{
if(x%a==0)
{
n++;
n+=f(x/a,a);
}
}
return n;
}
int main()
{
int m,i;
scanf("%d",&m);
int x[m],n[m];
for(i=0;i<m;i++)
{
scanf("%d",&x[i]);
n[i]=1+f(x[i],2);
}
for(i=0;i<m;i++)
{
printf("%d\n",n[i]);
}
return 0;
}
|
1 | 366 | //*******************************************************
//*?????????.cpp *
//*?????? *
//*?????2010?12?9? *
//*??????????????? *
//*?????????????????????????? *
// ??????????????????????? *
//*******************************************************
int a=2;//????????????
int result =0;//?????????????
void function(int,int);
int main()
{
int n=0;
int data=0;
int i=0;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>data;
function(data,a);
cout<<result<<endl;
result=0;//??
}
return 0;
}
void function(int x,int y)
{
int j=0;
if(x==1)//??????1 ????????????
{
result=result+1;
}
for(j=y;j<=x;j++)//??1
{
if(x%j==0)//????????
{
function(x/j,j);
}
}
} |
1 | 367 |
int kind (int k,int a)
{
int i,j,temp=0;
int x;
for (i=a;i<k;i++)
{
if (i<=k/i&&k%i==0)
{
x=k/i;
// printf("%d*%d=%d\n",x,i,k);
temp++;
for (j=i;j<x;j++)
{
if (j<=x/j&&x%j==0)
{
temp=temp+kind(x,j);
break;
}
}
}
}
return (temp);
}
int main ()
{
int n,i,s,a[32768][2];
scanf("%d",&n) ;
for (i=0;i<n;i++)
{
scanf("%d",&a[i][0]);
a[i][1]=kind(a[i][0],2);
}
for (i=0;i<n;i++)
{
printf("%d\n",a[i][1]+1);//k=k????
}
//scanf("%d",&n) ;
return 0;
}
|
1 | 368 | /*
* 187.cpp
*
* Created on: 2011-11-22
* Author: think
*/
int count(int a,int n){
if(a>n)return 0;
if(a==n)return 1;
int p=1;
int i;
for(i=a;i<=n;i++){
if(n%i==0&&i<=n/i){
p=p+count(i,n/i);
}
}
return p;
}
int geshu(int N){
int i;
int s=1;
for(i=2;i<=sqrt(N);i++){
if(N%i==0){
s=s+count(i,N/i);
}
}
return s;
}
int main(){
int N;
cin>>N;
int c[N];
int j;
for(j=0;j<N;j++){
cin>>c[j];
}
for(j=0;j<N;j++){
cout<<geshu(c[j])<<endl;
}
return 0;
}
|
1 | 369 | //????
//?????
int ana(int n,int p)
{
int i;
int t,s=1;
t=pow(n,0.5);
for(i=p;i<=t;i++)
if(n%i==0)
s=s+ana(n/i,i);//??
return s;
}
//???
int main()
{
int n;
int a[100];
int i;
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
for(i=0;i<n;i++)
cout<<ana(a[i],2)<<endl;//????
return 0;
}
|
1 | 370 | /*
* h35.cpp
* function:????
* Created on: 2012-11-30
* Author: sear
*/
//m????n???????????n???n??m,????n,???n??1
int f(int m, int n) { //m???,n????????
int i, sum = 0; //i?????,sum???????
if (n == 1)
return 1; //???????1???1
for (sum = 0, i = m; i <= n; i++)//?????????????????m???????m???
if (n % i == 0)
sum += f(i, n / i);//?n???????????n??i????
return sum; //??sum???????
}
int main() {
int i, n, k; //i?????,n????????,k?????????
for (i = 0, cin >> n; i < n; i++) {
cin >> k; //???????
cout << f(2, k) << endl;//???????
}
return 0; //????
}
|
1 | 371 | int breakways(int num, int min);
int main()
{
int n;
cin >> n;
int number;
for (int i = 1; i <= n ; i++)
{
cin >> number;
cout << breakways(number , 2) << endl;
}
}
int breakways(int num, int min)
{
int sum = 0;
for (int j = min ;j <= num ; j++)
{
if (num % j == 0)
{
if (num != j)
sum += breakways (num / j , j);
else
sum += 1;
}
}
return sum;
} |
1 | 372 | void fenjie(int);
int solutionnum=1;//????????1???
int main()
{ int n,a,i;
cin>>n;//????
for(i=1;i<=n;i++)
{cin>>a;//??????
fenjie(a);//???????????
cout<<solutionnum<<endl;//??
solutionnum=1;//?????
}
return 0;
}
int yinzi[100]={2},i=0;
//yinzi????????????????????????????????????????????????
void fenjie(int x)
{int j;
for(j=yinzi[i];j<x;j++)
{if(x%j==0&&x/j>=j)//j?x????????x??j????????j,??????
{i++; yinzi[i]=j;//?????????????
fenjie(x/j);//?????
j=yinzi[i]; i--;//?????
solutionnum++;}//????+1
}
} |
1 | 373 | int sum=0;
void f(int n,int i)
{
if(n==1) sum++;
while(i<=n)
{
if(n%i==0) f(n/i,i);
i++;
}
return ;
}
int main()
{
int t=0;
cin>>t;
while(t--)
{
int n=0;
cin>>n;
int i=2,result=1;
for (i=2;i<=n/2;i++) {
if(n%i==0)
{
sum=0;
f(n/i,i);
result=result+sum;
}
}
cout<<result<<endl;
}
return 0;
}
|
1 | 374 | int sum;
void f(int x,int i){
if(x == 1) sum++;
else{
for(;i <= x;i++)
if(x%i == 0) f(x/i,i);
}
}
int main(){
int n;
cin>>n;
while(n>0){
int x = 0,i,ans = 1;
cin>>x;
for(i = 2;i*i < x;i++){
if( x%i == 0) {
sum = 0;
f(x/i,i);
ans+=sum;
}
}
cout<<ans<<endl;
n--;
}
return 0;
}
|
1 | 375 | //????
int f(int x,int min){
if(x<min) return 0;
int r=1;
for(int i=min;i<x/2;i++){
if(x%i==0){
r+=f(x/i,i);
}
}
return r;
}
int main(){
int n;
cin>>n;
while(n--){
int x;
cin>>x;
cout<<f(x,2)<<endl;
}
}
|
1 | 376 | int DFS(int ,int );
int main()
{
int q;
cin>>q;
for(int i=0;i<q;i++)
{
int n;
int h=0;
cin>>n;
cout<<DFS(n,n)<<endl;
}
return 0;
}
int DFS(int n,int p)
{
int ans=0;
if(n==1)return 1;
for(int i=2;i<=p;i++)
{
if(n%i==0)
{
ans=ans+DFS(n/i,i);
}
}
return ans;
} |
1 | 377 | int num;
main()
{
void fenjie(int x,int qi);
int n,k,a;
scanf("%d",&n);
for(k=1;k<=n;k++)
{
num=0;
scanf("%d",&a);
fenjie(a,2);
printf("%d\n",num);
}
}
void fenjie(int x,int qi)
{
if(x==1) num++;
else
{
for(int i=qi;i<=x;i++)
{
if(x%i==0) fenjie(x/i,i);
}
}
} |
1 | 378 | int fenjieyinshi(int n,int m)//????????
{
int i=0;
int sum=1;
if(n<m)
return 0;//??????????????????0
else
{
for(i=m;i<n;i++)
if(n%i==0)//????????????????
sum+=fenjieyinshi(n/i,i);//??
return sum;
}
}
int main()//???
{//?????
int n=0;
int i=0;
int a=0;
cin>>n;//???????????????
for(i=0;i<n;i++)
{
cin>>a;//???????
if(a==1)
cout<<1<<endl;
else
cout<<fenjieyinshi(a,2)<<endl;//????
}
return 0;
}//????? |
1 | 379 |
int cal(int M, int N)
{
int i;
int num=0;
if(M==1) return 0;
if(N>=M) return ( 1+cal(M,M-1));
for(i=2;i<M;i++)
{
if(M%i==0&&i<=N) num=num+cal(M/i,i);
}
return num;
}
int main()
{
int n,M;
cin>>n;
while(n--)
{
cin>>M;
cout<<cal(M,M)<<endl;
}
return 0;
}
|
1 | 380 | int main()
{
int i,j,num[100],n,m;
int fj(int ,int );
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%d",&num[i]);
for(i=1;i<=n;i++)
printf("%d\n",fj(2,num[i]));
return 0;
}
int fj(int k,int n)
{
int c,i,sum=1;
if(n==2) return(sum);
else if(n==3) return(sum);
else
{
c=(int)sqrt(n);
for(i=k;i<=c;i++)
if(n%i==0) sum=sum+fj(i,n/i);
return(sum);
}
}
|
1 | 381 | int main()
{
int fenjie(int m,int i);
int n,i,c[100];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&c[i]);
for(i=0;i<n;i++)
printf("%d\n",fenjie(c[i],2));
return 0;
}
int fenjie(int m,int i)
{
int l = 1,j;
int t = sqrt((float)m);
for (j = i; j <= t; ++j)
{
if (m % j == 0)
l += fenjie(m/j, j);
}
return l;
} |
1 | 382 |
int factor(int a,int b){
int i,ways;
ways=1;
if(a<b)
return 0;
for(i=b;i<=sqrt(a);i++){
if(a%i==0)
ways+=factor(a/i,i);
}
return ways;
}
int main(){
int n,A[99],K[99],i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
K[i]=factor(A[i],2);
}
for(i=0;i<n;i++){
printf("%d\n",K[i]);
}
return 0;
}
|
1 | 383 | int check(int n,int i)
{
for(i=2; i<=n/2;i++)
if(n%i==0)
break;
return (i==n/2&&n!=4)?1:0;
}
int f(int n, int k)
{
if (check(n,2)==1 || k==n)
return 1;
else if(n<k)
return 0;
else
{
int h=0,i;
for( i=k;i<=sqrt(n);i++)
if(n%i==0)
h+=f(n/i,i);
return h+1;
}
}
void main()
{
int n,h,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&h);
printf("%d\n",f(h, 2));
}
}
|
1 | 384 | int yinshu(int be,int by)
{
int i,sum=0;//cout<<be<<' '<<by<<endl;
for(i=by;i*i<=be;i++)
{
if(be%i==0){sum+=1+yinshu(be/i,i);}
}
return sum;
}
int main()
{
int n,i,j,num,sign
;
cin>>n;
for(i=0;i<n;i++)
{
cin>>num;for(j=num;j>1;j--)if(num%j==0)sign=j;
cout<<yinshu(num,sign)+1<<endl;
}
getchar();getchar();
return 0;
}
|
1 | 385 | //********************************
//*???1.cpp **
//*?????? 1200012768 **
//*???2012.11.28 **
//*??????? **
//********************************
int fun(int n, int m);
int main()
{
int n, num;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> num;
cout << fun(num, 2) << endl;
}
return 0;
}
int fun(int n, int m)
{
int sum = 1; //n??????????
double t = sqrt(n);
for (int i = m; i <= t; i++) //???????????????t
if (n % i == 0) //???i?n???????????
sum += fun(n /i, i);
return sum;
} |
1 | 386 | /*????
* divide.cpp
*
* Created on: 2011-12-1
* Author: WJ
*/
int sum=1; //?????1?????
void f(int b,int a) //??????????????
{
for(int i=b;i<=a;i++){ //????????
if((a%i==0)&&(i<=a/i)){
sum=sum+1; //???1
f(i,a/i); //???????????
}
if(i>a/i) break;
}
}
int main()
{
int a,n;
cin>>n;
while(n>0){ //??????
cin>>a;
sum=1;
f(2,a); //????
cout<<sum<<endl; //????
n--;
}
return 0;
}
|
1 | 387 | int fenjie(int a,int b)
{
int c=1,i;
for(i=b;i<=(int)sqrt(a);i++)
{
if(a%i==0)
c+=fenjie(a/i,i);
}
return c;
}
main()
{
int n,i,a,c;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a);
c=fenjie(a,2);
printf("%d\n",c);
}
} |
1 | 388 | int fenj(int x, int y) {
int a=(x==1),i;
for (i=y;i<=x;i++)//???2?????????
if(x%i==0)a=a+fenj(x/i,i);//?????????
return a;
}
int main(){
int k;
cin>>k;
int a[k];
for(int i=0;i<k;i++)cin>>a[i];
for(int i=0;i<k;i++)cout<<fenj(a[i],2)<<endl;
return 0;
} |
1 | 389 |
int N, A;
int acSearch(int n, int i) {
int ret = 0;
if(n == 1) ret = 1;
else for(; i <= n; ++ i)
if(n%i == 0) ret += acSearch(n/i, i);
return ret;
}
int main() {
scanf("%d", &N);
for(; N --;) {
scanf("%d", &A);
printf("%d\n", acSearch(A, 2));
}
return 0;
}
|
1 | 390 | //**************************************
//**???12.1?????? ***
//**????? ???1000012888 ***
//**************************************
int f(int, int);//??f??????????
int main()
{
int n, a, i;
cin >> n;
for (i = 1; i <= n; i++)
{
cin >> a;
cout << f(a, 2) << endl;
}
return 0;
}
int f(int x, int b)//f(a,b)?a?????b?????????
{
int j, re = 1;//??a=a???????re???0
if(x < b)
return 0;
for (j = b; j < x; j++)
{
if(x % j == 0)
re = re + f(x / j, j);//????????????????
}
return re;//??re
} |
1 | 391 | /*
* ????factorization.cpp
* ??????
* ????:2012-11-26
* ???????
*/
int j=2; //??????j
int kinds(int x){ //????kinds
int sum=1;
if(x==1)return 0; //?????????1????1?????????0
for(int i=j;i<=sqrt(x);i++) //?for????x????????1??i??
if(x%i==0) //??x???i?????????i??????????
{
sum+=kinds(x/i); //??????x/i????
j=i+1; //??????i????????x????
}
return sum; //???????????
}
int main(){ //???
int n=0;
cin>>n; //?????????n
for(int i=0;i<n;i++)
{
int x=0; //????x
cin>>x; //??x
cout<<kinds(x)<<endl; //??x????????kinds
j=2; //??
}
return 0; //?????
} |
1 | 392 |
int num;
void f(int n,int i);
main ()
{
int i,j,k,n,order,top;
for (scanf("%d",&order);order>=1;order--)
{
scanf("%d",&n);
num=0;
top=(int)sqrt(n);
for (i=1;i<=top;i++)
{
if (n%i==0)
{
num++;
//printf("n=%d i=%d top=%d\n",n,i,top);
f(n/i,i);
}
}
printf("%d\n",num);
}
}
void f(int n,int btm)
{
if (btm==1) return;
int top,i;
top=(int)sqrt(n);
//printf("f:n=%d i=%d top=%d\n",n,i,top);
if (top>=btm)
{
for (i=btm;i<=top;i++)
{
//printf("f:n=%d i=%d top=%d\n",n,i,top);
if (n%i==0)
{
num++;
f(n/i,i);
}
}
}
} |
1 | 393 | int s=0,p=1;
void fenjie(int a,int b)
{
int i;
if(a==1)
s++;
for(i=b;i<=a;i++)
if(a%i==0) fenjie(a/i,i);
return;
}
int main()
{
int n,i,j,a[100];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
for(j=2;j*j<=a[i];j++)
{
if(a[i]%j==0)
{
s=0;
fenjie(a[i]/j,j);
p=p+s;
}
}
printf("%d\n",p);
p=1;
}
return 0;
}
|
1 | 394 | int f(int,int); //????
int main( ) //?????
{ //?????
int n,i,a[50];
cin >>n; //??????
for(i=0;i<n;i++){
cin >>a[i]; //????
cout <<f(a[i],2) <<endl; //????
}
return 0; //???????????????????
} //?????
int f(int n,int p) //??????????????p?????
{
int sum=0,m;
if(n<p) return 0;
else{
for(m=p;m<=n;m++)
if(n%m==0){
if(m<n) sum=sum+f(n/m,m); //n?????m??????n/m??????m???????
if(m==n) sum=sum+1; //n?????n??????1
}
return sum;
}
}
|
1 | 395 |
int f(int shu,int min)
{
int k=1;
if(shu < min)
{
k= 0;
return k;
}
else
{
for(int i = min;i<shu;i++)
{
if(shu%i == 0)
{
k=k+ f(shu/i,i);
}
}
return k;
}
}
main()
{
int n,i,a;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a);
if(i!=n-1)
printf("%d\n",f(a,2));
else
printf("%d",f(a,2));
}
} |
1 | 396 | int means(int,int);
int main()
{
int n,i=0;
cin>>n;
while(i<n)
{
int a;
cin>>a;
cout<<means(a,a)<<endl;
i++;
}
return 0;
}
int means(int a,int b)
{
int i,sum=0;
if(a!=1)
{
for(i=b;i>=2;i--)
{
if(a%i==0)
{
sum=sum+means(a/i,i); //?i????a??????a/i???a/i??????i????????????
}
}
return sum; //?????a???????????
}
else
{
return 1; //?a=1?????????1
}
} |
1 | 397 |
const int mov[4][2] = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}};
int m, n, counter;
void dfs(int m, int i) {
//cout << m << ' ' << n << endl;
if (m == 1) {
++counter;
return;
}
for (;i <= m; ++i) {
if (m % i == 0) {
dfs(m/i, i);
}
}
}
int main() {
int t, m, n;
cin >> t;
while (t--) {
counter = 0;
cin >> m;
dfs(m, 2);
cout << counter << endl;
}
} |
1 | 398 |
int f(int a,int min)//???a???????min?????????
{
int i;
if(a < min)//??????
{
return 0;
}
int result = 1;
for(int i = min;i<a;i++)//??????
{
if(a % i == 0)
{
result += f(a/i,i);
}
}
return result;
}
int main()
{
int n,a;//????
cin>>n;
while(cin>>a)//????
{
cout<<f(a,2)<<endl;//????
}
return 0;
}
|
1 | 399 |
int cal(int y,int x)
{
int i,sum;
if (x==1) return 1;
else
{
sum=0;
for (i=y;i<=x;i++)
{
if ((x%i==0)&&((x/i==1)||(x/i>y))) sum+=cal(i,x/i);
}
return sum;
}
}
int main()
{
int n,i,l;
scanf("%d",&n);
for (i=1;i<=n;i++)
{
scanf("%d",&l);
printf("%d",cal(2,l));
if (i!=n) printf("\n");
}
return 0;
}
|