label
stringlengths 1
2
| index
stringlengths 1
5
| code
stringlengths 87
8.24k
|
---|---|---|
1 | 100 | /*
* Created on: 2011-11-18
* Author: 1100012870
*/
int su[40000],b[10000],ans;
void zhaosushu()
{
int i,j,p;
for(i=2;i<32768;i++)
{
p=1;
for(j=2;j<=sqrt(i);j++)
if(i%j==0){
p=0;
break;
}
if(p==0)continue;
su[p]=1;
}
}
void resolve(int a,int x)
{
int i;
if(a==1 || (su[a]==1 && a>=b[x-1])) {
ans++;
return;
}
for(i=2;i<=a;i++)
if(a%i==0 && i>=b[x-1]){
b[x]=i;
resolve(a/i,x+1);
b[x]=0;
}
}
int main()
{
int n,i,a;
memset(su,0,sizeof(su));
zhaosushu();
cin>>n;
for(i=1;i<=n;i++)
{
cin>>a;
ans=0;
memset(b,0,sizeof(b));
resolve(a,1);
cout<<ans<<endl;
}
return 0;
} |
1 | 101 | int num;
int fjys(int n,int m,int i,int d,int ji[20])
{
int a;
for(a=i;a<m;a++)
{
if(n%a==0)
{
ji[d]=a;
int chenji=1,k;
for(k=0;k<=d;k++)
chenji=chenji*ji[k];
if(chenji==m)
{
num++;
break;
}
else
fjys(n/a,m,a,d+1,ji);
}
}
return num;
}
int main()
{
int m,n,j,result=0,ji[20]={0};
cin>>m;
for(j=1;j<=m;j++)
{
num=0;
cin>>n;
result=fjys(n,n,2,0,ji);
cout<<result+1<<endl;
}
return 0;
}
|
1 | 102 | int panduansushu(int t)
{
int i;
for(i=2;i<t;i++)
{
if(t%i==0){break;}
}
if(i>t/2)return 1;
else return 0;
}
int sum=0;
void fun(int n,int i)
{
if(n==1)sum++;
for(;i<=n;i++)
{
if(n%i==0)fun(n/i,i);
}
}
void main()
{
int a[100],i,res,j,n;
scanf("%d",&n);
for(j=0;j<n;j++)scanf("%d",&a[j]);
for(j=0;j<n;j++)
{
if(panduansushu(a[j])==1)
{
printf("1\n");
}
else{ for(i=2,res=1;i<a[j]/2;i++)
{
if(a[j]%i==0){sum=0;fun(a[j]/i,i);res+=sum;}
}
printf("%d\n",res);}}
} |
1 | 103 | int p=0;
int factor(int a,int min)
{
int sum=0;
if(min>=a)return 1;
for(int j=min;j<=a/min;j++)
if (a%j==0)
sum+=factor(a/j,j);
return sum;
}
int main()
{
int n=0,a=0;
cin>>n;
while(n>0)
{
cin>>a;
if(a<=2) cout<<1<<endl;
else cout<<factor(a,2)+1<<endl;
n--;
}
return 0;
} |
1 | 104 | int sum=0; //???????
void fj(int n,int m)
{
int i; //?????
for(i=m;i<=sqrt(n);i++) //???????
{
if(n%i==0)
{
sum++;
fj(n/i,i); //???????
}
}
}
int main()
{
int j,N; //??????????????
int a[100]; //?????
cin>>N;
for(j=1;j<=N;j++)
{
cin>>a[j]; //?????
}
for(j=1;j<=N;j++)
{
sum=0;
fj(a[j],2); //?????
cout<<sum+1<<endl;
}
return 0;
}
|
1 | 105 | int f(int x,int k);
int main()
{
int i=1,n,m;
int result;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&m);
result=f(m,2);
printf("%d\n",result);
}
return 0;
}
int f(int x,int k)
{
int a=0;
int i;
if (x==1)
return 1;
for (i=k;i<=x;i++)
{
if (x%i==0)
a=a+f(x/i,i);
}
return a;
}
|
1 | 106 | int count;
void solve(int num,int a,int m)
{
int i;
if(num==1)
{
count++;
return;}
for(i=2;i<=num;i++)
{
if(i>=a&&(num%i)==0)
solve(num/i,i,m+1);
}
}
main()
{
int n,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
int num,a;
count=0;
scanf("%d",&num);
solve(num,0,1);
printf("%d\n",count);}
} |
1 | 107 | //
// main.c
// ???? ? ??????????
//
// Created by zhaoze on 13-11-5.
// Copyright (c) 2013? zhaoze. All rights reserved.
//
void next(int c[],int x)
{
int i,j;
c[0]++;
for (i=1; c[0]*c[1]*c[2]*c[3]*c[4]*c[5]*c[6]*c[7]*c[8]*c[9]*c[10]*c[11]*c[12]*c[13]*c[14]>x; i++)
{
c[i]++;
for (j=0; j<i; c[j++]=c[i]);
if (c[14]==2) break;
}
}
int reslove(int x)
{
int c[15]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
int p=0;
while (c[0]*c[1]*c[2]*c[3]*c[4]*c[5]*c[6]*c[7]*c[8]*c[9]*c[10]*c[11]*c[12]*c[13]*c[14]<=x)
{
if (c[0]*c[1]*c[2]*c[3]*c[4]*c[5]*c[6]*c[7]*c[8]*c[9]*c[10]*c[11]*c[12]*c[13]*c[14]==x) p++;
next(c, x);
}
return p;
}
void main()
{
int i=0,n,a;
scanf("%d",&n);
while (i++<n)
{
scanf("%d",&a);
printf("%d\n",reslove(a));
}
/*
*int c[15]={2,2,2,2,1,1,1,1,1,1,1,1,1,1,1};
*int x=20;
*{next(c, x);
*printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d \n",
* c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14]);}
*/
} |
1 | 108 | int yz[100],all=0;
int yinzi(int num,int amax)
{
int i,j=0,geshu=0,key=num;
if(num==1) return 1;
else
{
for (i=amax;i<all;i++)
{
if(num%yz[i]==0)
{
num=num/yz[i];
geshu=geshu+yinzi(num,i);
num=key;
}
}
return geshu;
}
return 0;
}
int main ()
{
int num,n,i,c,j=0,k;
cin>>n;
for(k=0;k<n;k++)
{
cin>>num;
if(num==1) cout<<1<<endl;
else
{
j=0;
for (i=2;i<=num;i++)
{
if(num%i==0)
{
yz[j]=i;
j++;
}
}
all=j;
cout<<yinzi(num,0)<<endl;
}
}
return 0;
}
|
1 | 109 |
int factorize(int n,int j)
{
int F=1;
for(;j<=sqrt(n);j++)
if(n%j==0)
F+=factorize(n/j,j);
return F;
}
int main()
{
int i,m,n[1000];
scanf("%d",&m);
for(i=0;i<m;i++)
scanf("%d",&n[i]);
for(i=0;i<m;i++)
printf("%d\n",factorize(n[i],2));
return 0;
} |
1 | 110 | /*
* fengjie.cpp
*
* Created on: 2013-11-23
* Author: sony
*/
int sum;
void f(int x,int i){
if (x == 1) sum++;
for(;i<=x;i++)
if (x%i == 0) f(x/i,i);
return;
}
int main(){
int t,a,i=2;
cin>>t;//????????
for (a = 0; a<t ; a++){
int x;
cin >> x;
int ans = 1;
for(i = 2; i<sqrt(x) ; i++){
sum = 0;
if(x%i == 0) f(x/i,i);
ans = ans + sum;
}
cout<<ans<<endl;
}
return 0;
}
|
1 | 111 | /**
* @file ????.cpp
* @author ?? 1000012792
* @date 2010.12.3
*/
int f(int n, int m); //??f:????m????n?????????????????
int main()
{
int n, num, i;
cin >> n; //n???n???
for(i=0;i<n;i++)
{
cin >> num; //????????num,????????
cout << f(num, 2) << endl;
}
return 0;
}
int f(int n, int m)
{
int i, count=0;
if(n==1)
return 1; //??n=1?????????1
for(i=m;i<=n;i++) //?????i?m?????n??
{
if(n%i==0) //??n??i???????n/i????(???????i)???????f(n/i,i)
count += f(n/i,i); //count?????????
}
return count; //??count??
} |
1 | 112 | int factors(int n,int min)
{
int varieties=0,i;
if(n==1) return 1;
else
{
for(i=min;i<=n;i++)
{
if(n%i==0)
{
varieties+=factors(n/i,i);
}
}
}
return varieties;
}
int main()
{
int n;
cin>>n;
int a[n],b[n];
int i;
for(i=0;i<n;i++)
{
cin>>a[i];
b[i]=factors(a[i],2);
}
for(i=0;i<n;i++)
cout<<b[i]<<endl;
return 0;
}
|
1 | 113 | int t;
int main()
{int n,i,a[100];
void fenjie(int x,int y);
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
{t=0;
fenjie(2,a[i]);
printf("%d\n",t);
}
return 0;
}
void fenjie(int x,int y)
{int j;
if(y==1){
t++;
return;}
for(j=x;j<=y;j++)
{if(y%j==0)
fenjie(j,y/j);
}
}
|
1 | 114 | /*
*????????.cpp
*?????
* Created on: 2012-11-30
* ??????????a?????????????????a = a1 * a2 * a3 * ... * an?
??1 < a1 <= a2 <= a3 <= ... <= an?????????????????a = a???????
*/
int yinshu(int n,int m)
{
int i,sum=0; //????
if(n==1) //??if??
return 1;
for(i=m;i<=n;i++) //??for??
{
if(n%i==0) //?????
sum+=yinshu(n/i,i); //?????
}
return sum;
}
int main() //???
{
int n,i,m; //????
cin>>n; //????
for(i=1;i<=n;i++) //??for??
{
cin>>m; //????
cout<<yinshu(m,2)<<endl; //?????????
}
return 0; //????
}
|
1 | 115 |
int count;
void fun(int i, int j)
{
int k;
for(k=i; k<=sqrt(j); k++) {
if(j%k == 0) {
count++;
fun(k,j/k);
}
}
}
int main()
{
int N,turn,c;
scanf("%d",&turn);
for(c=1;c<=turn;c++)
{
int n,i;
scanf("%d",&n);
for(i=2; i<=sqrt(n); i++) {
if(n%i == 0) {
count++;
fun(i,n/i);
}
}
printf("%d\n",count+1);
count=0;
}
}
|
1 | 116 | //????
int divide(int n,int i); //???? n???????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/2;j++) //???????????1*n???
{
sum=sum+divide(n,j);
}
cout<<sum+1<<endl;
}
return 0;
}
int divide(int n,int i) //???????????????1???
{
int num=0;
if(n%i==0)
{
if(n==i) //?????????????????1
{
return 1;
}
for(int j=2;j<=i;j++)
{
num=num+divide(n/i,j); //??
}
return num;
}
else
{
return 0;
}
} |
1 | 117 | int fun(int x,int y)
{
int i,sum=0;
for(i=x;i*i<=y;i++)
if(y%i==0) {sum++;sum+=fun(i,y/i);}
return sum;
}
int main()
{
int n,i,sum;
scanf("%d",&n);
while(n>0)
{ n--;
scanf("%d",&i);sum=1;
sum+=fun(2,i);
printf("%d\n",sum);
}
return 0;
} |
1 | 118 | int s;
void search(int a,int k)
{
if(a==0)
return ;
if(a==1)
{
return;
}
for(int i=2;i<a;i++)
{
if(a%i==0&&a/i>=i&&i>=k&&a/i>=k)
{
s++;
search(a/i,i);
}
}
return ;
}
int main()
{
int n,a;
cin>>n;
for(int i=0;i<n;i++)
{
s=1;
cin>>a;
search(a,1);
cout<<s<<endl;
}
return 0;
}
|
1 | 119 | /*1090 ????*/
int num;
void divide(int a,int k)
{
int i;
if(a==1) num++;//??????????????
for(i=k;i<=a;i++)//????????
if(a%i==0) divide(a/i,i);
}
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
num=1;
int i;
for(i=2;i*i<=n;i++)
if(n%i==0) divide(n/i,i);
cout<<num<<endl;
}
return 0;
} |
1 | 120 |
int main()
{
int n,a[100];
int i;
int f(int x,int min); //f:???????
for(i=0;i<100;i++)
a[i]=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
a[i]=f(a[i],2);
}
for(i=0;i<n;i++)
{
printf("%d\n",a[i]);
}
return 0;
}
int f(int x,int min)
{
int y=0;
int i;
if(x==1)
y=1;
else
{
for(i=min;i<=x;i++)
{
if(x%i==0)
{
y=y+f(x/i,i);
}
}
}
return y;
} |
1 | 121 | int prime(int n)
{
int i,judge=1;
for(i=2;i<n;i++)
{
if(n%i==0)
judge=0;
}
return judge;
}
int function(int number,int x)
{
int temp=0,i,result=0;
if(!prime(number))
{
for(i=x;i<=number;i++)
if(number%i==0)
{
x=i;
temp=number/i;
result+=function(temp,x);
}
}
else if((number>=x||number==1)&&prime(number))
result=1;
return result;
}
int main()
{
int i,times,number;
cin>>times;
for(i=0;i<times;i++)
{
cin>>number;
cout<<function(number,2)<<endl;
}
return 0;
}
|
1 | 122 | /*
* ????.cpp
* Created on: 2012-11-19
* Author:???
*/
int f(int a,int b){//?a???????b?????????
int num=1,i;
for(i=b;i<=sqrt(a);i++){//??b?a???????????a?
if(a%i==0)num+=f(a/i,i);//????a??????????a??????????i??????
}
return num;//????
}
int main(){
int i,n,a;
cin>>n;//???????
for(i=1;i<=n;i++){
cin>>a;
cout<<f(a,2)<<endl;//???????
}
return 0;
}
|
1 | 123 |
int all=1; //?????????????????????1
void divd(int,int); //??????????????????????????????
int main()
{
int n,num;
cin>>n;
while(n--)
{
cin>>num;
divd(2,num); //????2???????
cout<<all<<endl;
all=1;
}
return 0;
}
void divd(int fac,int num)
{
int i;
for(i=fac;i*i<=num;i++) //???????????????????????????
if(num%i==0) //?????????
{
fac=i; //??
all++; //????
divd(fac,num/fac); //??????????
}
} |
1 | 124 |
int dp[40000][200]={0};
int main()
{
int n,i,N;
int mm( int , int );
cin>>n;
for(i=1;i<=n;i++)
{
cin>>N;
cout<<mm(N,2)<<endl;
// if(prime(N)) cout<<"haha";
}
return 0;
}
int mm( int n, int i)
{
int sum=1;
if(dp[n][i]>0) return dp[n][i];
for(int j=i; j<=sqrt(n);j++)
{
if(n%j==0)
{
sum += mm(n/j,j);
}
}
dp[n][i]=sum;
return sum;
}
|
1 | 125 | int sum=0,used[32770]={0};//????sum???????????used?i???i????????
void f(int n)//??f??n????????
{
for(int i=2;i<=n;i++)
{
if(n%i==0&&used[i]==0)
{
if(i!=2)
{
for(int j=2;j<=i-1;j++)
used[j]=1;
}
if(n/i==1)//??????????
{
sum++;
break;
}
else
{
f(n/i);
}
memset(used,0,sizeof(used));//?used???????
}
}
}
int main()
{
int m,a[100];
cin>>m;
for(int i=1;i<=m;i++)
{
cin>>a[i];
if(a[i]==1)
cout<<1<<endl;
else
{
f(a[i]);
cout<<sum<<endl;
sum=0;//??
memset(used,0,sizeof(used));
}
}
return 0;
} |
1 | 126 | int prime(int n, int m )
{
int i,total=1;
if(n<m)return 0;
for(i=m;i<=n;i++)
{
if(n%i==0)
total+=prime(n/i,i);
}
return total;
}
void main()
{
int n,b[2000],b0,i;
scanf("%d",&n);
for(i=0;i<=n-1;i++)
{
scanf("%d",&b0);
b[i]=prime(b0,2);
}
for(i=0;i<=n-2;i++)
{
printf("%d\n",b[i]);
}
printf("%d",b[n-1]);
}
|
1 | 127 | int sushu(int b)
{
int flag=1,i;
if(b==2)
return 1;
if(b%2==0)
return 0;
for(i=2;i<=b/2;i++)
{
if(b%i==0)
{
flag=0;
break;
}
}
if(flag==0)
return 0;
else
return 1;
}
int number(int a,int b)
{
int i,total=1;
if(sushu(a))
{
total=1;
return total;
}
for(i=b;i<=a;i++)
{
if(a%i==0&&a/i>=i)
{
total=total+number(a/i,i);
}
}
return total;
}
void main()
{
int n,i,A[100],B[100];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&A[i]);
B[i]=number(A[i],2);
}
for(i=0;i<n;i++)
{
printf("%d\n",B[i]);
}
} |
1 | 128 | int sushu(int a)
{
int b=2,c,d=0,k;
while (b<a)
{
c=a%b;
if (c!=0)
{
b=b+1;
d=d+1;}
else break;
}
if(d==(a-2))
k=1;
else
k=0;
return k;
}
int zheng(int n,int i)
{
int sum=1,a;
for(a=i;a<n/2;a++)
{
if(n%a==0)
{
if(a<=n/a)
{
sum=sum+zheng(n/a,a);
}
}
}
return sum;
}
int main ()
{
int n,i,j=0,k=0,b[10000]={0},e[40000]={0};
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&e[i]);
}
for(i=0;i<n;i++)
{
if(sushu(e[i])==0)
{
b[i]=zheng(e[i],2);
}
else
{
b[i]=1;
}
}
printf("%d",b[0]);
for(i=1;i<n;i++)
printf("\n%d",b[i]);
return 0;
} |
1 | 129 | int F(int n,int a)
{
if(n==1) return 1;
if(a==1) return 0;
if(n%a==0) return F(n/a,a)+F(n,a-1);
return F(n,a-1);
}
main()
{
int n,a,i;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a);
printf("%d\n",F(a,a));
}
} |
1 | 130 | int f(int m, int n)
{
int i, count = 0, flag = 0;
if (m == 1)
return 1;
for (i = n; i > 1 ; i--)
{
if (m % i == 0)
{
count += f(m / i, i);
flag = 1;
}
}
if (flag)
return count;
else
return 0;
}
int main()
{
int n, k, m, temp;
cin >> n;
for (k = 0; k < n; k++)
{
cin >> m;
cout << f(m, m) << endl;
}
return 0;
} |
1 | 131 | void fun(int m, int i); //????
int num ;
int main()
{
int n, i, a;
cin>>n;
for(i = 0; i < n; i++)
{
cin>>a;
num = 0;
fun(a, 2); //????
cout<<num + 1<<endl; //???????a=a???????num??1
}
return 0;
}
void fun(int m, int i)
{
int k = sqrt(m);
for(i = i; i <= k; i++)
{
if(m % i == 0)
{
num++;
fun(m / i, i); //?????????
}
}
} |
1 | 132 | main()
{
int find(int m,int k);
int n,y,d,c;
scanf("%d",&c);
for(d=0;d<c;d++)
{
scanf("%d",&n);
y=find(n,1) ;
printf("%d\n",y);
}
}
int find(int m,int k)
{
int i,t=1,n=0,x=0,a,s=0;
for(i=2;i<=m;i++)
{
if(m%i==0)n++;
}
if(n==1||m==1)return 1;
else
{
for(i=2;i<=m;i++)
{
if(m%i==0&&m/i>=i&&i>=k)
{
k=i;
t=t+find(m/i,k);
}
}
}
return t;
} |
1 | 133 |
int function(int a, int m)
{
int sum=1,i;
if(a>m)
return 0;
else
{
for(i=a;i<m;i++)
{
if(m%i==0)
sum=sum+function(i,m/i);
else
continue;
}
return sum;
}
}
void main()
{
int n,i,m[100];
scanf("%d",&n);
for(i=0;i<=n-1;i++)
{
scanf("%d",&m[i]);
}
for(i=0;i<=n-1;i++)
{
printf("%d\n",function(2,m[i]));
}
}
|
1 | 134 | //***************************************************
//1.cpp ???? ******
//?? ??? 1200018209 ********
//?? 2012-11-27 ******
//***************************************************
int dispose(int , int);
int main()
{
int n,i,p;
cin >> n;
for(i=0;i<n;i++)
{
cin >> p;
cout << dispose(p,2) << endl;
}
return 0;
}
int dispose(int p,int y)
{
int i,sol=1; //?????sol??????
for(i=y ; i<=(int)(sqrt(p)) ; i++)
{
if(p%i==0)
{
sol += dispose(p/i,i); //??????return????????????????
}
}
return sol;
} |
1 | 135 | int p(int x)
{
int i;
for(i=2;i<=sqrt(x);i++) if(x%i==0) return(0);
return(1);
}
int f(int n,int m)
{
int t,i;
if(n<m) return(0);
else if(p(n)==1) return(1);
else if(m==1)
{
t=1;
for(i=m+1;i<n;i++)
{
if(n%i==0) t=t+f(n/i,i);
}
}
else if(m!=1)
{
t=1;
for(i=m;i<n;i++)
{
if(n%i==0) t=t+f(n/i,i);
}
}
return(t);
}
main ()
{
int x,y,z,j;
scanf("%d",&y);
for(j=0;j<y;j++)
{
scanf("%d",&x);
printf("%d\n",f(x,1));
}
} |
1 | 136 | int tot;
void find(int m,int n)
{
int i,j,k;
if (m==1) tot=tot+1;
else
{
for (i=n;i<=m;i++)
if(m%i==0)
find (m/i,i);
}
}
int main()
{
int i,j,k,m,n;
cin >>n;
for (i=1;i<=n;i++)
{
tot=0;
cin >>m;
find(m,2);
cout <<tot<<endl;
}
cin >>n;
return 0;
}
|
1 | 137 | int num=0;
void count(int m,int j)
{
int i;
if(m==1) num++;
for(i=j;i<=m;i++)
{
if(m%i==0) {count(m/i,i);}
else continue;}
}
int main()
{
int n,i;
cin>>n;
for(i=1;i<=n;i++)
{
int m;
cin>>m;
num=0;
count(m,2);
cout<<num<<endl;
}
return 0;
}
|
1 | 138 | int f(int n,int min){
int i,result=1;
if(n<min)return 0;
for(i=min;i<n;i++)
if(n%i==0)result+=f(n/i,i);
return result;
}
void main()
{
int cases,a;
scanf("%d",&cases);
while(cases--){
scanf("%d",&a);
printf("%d\n",f(a,2));
}
} |
1 | 139 | int count;
void f(int x,int y)
{
int i=0;
if(x>=y)
for(i=y;i<=x;i++)
{
if(i==x)count++;
if(x%i==0) f(x/i,i);
}
}
main()
{
int t;
int n,i,x,j;
scanf("%d",&n);
for(i=0;i<n;i++)
{
count=0;
scanf("%d",&x);
f(x,2);
printf("%d\n",count);
}
} |
1 | 140 | int num=1,k=0;
int count(int n)
{
for(int i=2;i<=sqrt(n);i++)
{
if(n%i==0&&i>=k)
{
num++;
k=i;
count(n/i);
k=0;
}
}
return (num);
}
int main()
{
int i,n,a[100];
cin>>n;
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(i=0;i<n;i++)
{cout<<count(a[i])<<endl;num=1;k=0;}
return 0;
} |
1 | 141 |
int main()
{
int f(int x, int y);
int n,m,i,z;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&m);
z=f(1,m);
printf("%d\n",z);
}
return 0;
}
int f(int x, int y)
{
int z,t=1,l=0,p;
p=(int) pow(y,0.5);
if(x==1) x=2;
for(z=x;z<=p;z++)
{
if(y%z==0 && z!=y)
{
t+=f(z,y/z);
}
}
return t;
} |
1 | 142 | int num=0;
int judge1(int n)
{
int i;
if(n==2||n==3||n==5)
return 1;
if(n==4)
return 0;
for(i=2;i*i<n;i++)
{
if(n%i==0)
{return 0;break;}
}
if(i*i>n)
return 1;
}
void divide(int n,int d)
{
for(int i=d;i*i<=n;i++)
{
if(n%i==0)//&&judge1(i))
{
num++;
divide(n/i,d);
}
d++;
}
}
int main()
{
int n,m;
cin>>n;
while(n)
{
n--;
cin>>m;
num=1;
divide(m,2);
cout<<num<<endl;
}
return 0;
} |
1 | 143 |
int f(int q,int x)
{
if(q<x)
{ int i,k,p,sum;
k=0;sum=0;p=0;
for(i=2;i<=x/2;i++)
if(x%i==0) k=k+1;
if(k==0) return 1;
else
{ for(i=q;i<=sqrt(x);i++)
if(x%i==0)sum=sum+f(i,x/i);
return sum+1;
p=0;
sum=0;
}
}
else
{ if(q==x) return 1;
else
return 0;
}
}
int main()
{
int n,i,x,sum;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&x);
sum=f(2,x);
printf("%d\n",sum);
}
} |
1 | 144 | int num =0;
void fenjie(int n,int x)
{
extern int num;
if ( n == 1)
num ++;
else
for(int i = x; i<=n;i++)
if(n % i == 0)
fenjie(n/i,i);
}
int main()
{
int n,k;
cin >> k;
for(int j = 0;j!= k;j++)
{extern int num;
num =0;
cin >> n;
fenjie(n,2);
cout<<num<<endl;
}
return 0;
} |
1 | 145 | int c;
void cal(int n,int k);
int main(int argc)
{ int m,n,j;
cin>>m;
for (j=1;j<=m;j++)
{ cin>>n;
c=0;
cal(n,1);
cout<<c<<endl;}
return 0;
}
void cal(int n,int k)
{ if (n==1)
{c++;
return;}
int i;
for (i=2;i<=n;i++)
{ if (n%i==0&&i>=k)
{cal(n/i,i);}}
} |
1 | 146 | void fenjie(int, int, int);
int g_num, g_count;
int main()
{
int n, i;
cin >> n;
for(i = 1; i <= n; i++ )
{
g_count = 0;
cin >> g_num;
fenjie(2, g_num, 1);
cout << g_count << endl;
}
return 0;
}
void fenjie(int a, int num, int sum)
{
while( a <= g_num )
{
sum *= a;
if( sum == g_num )
g_count++;
if( sum < g_num )
fenjie(a, g_num, sum);
if( sum > g_num )
return;
sum /= a;
a++;
}
} |
1 | 147 | int Factorization(int,int);
int main()
{
int n,x,i,k;
cin>>n;
for(i=0;i<n;i++)
{
cin>>x;
cout<<Factorization(x,2)+1<<endl;
}
return 0;
}
int Factorization(int x,int y)
{
int i;
int sum=0;
if(x<4)
return 0;
else
{
for(i=y;i<=sqrt((double)x);i++)
if(x%i==0)
sum+=1+Factorization(x/i,i);
return sum;
}
}
|
1 | 148 | int zhi(int a);
int yin(int m,int t);
int main()
{
int n,i=0;
int str[10000];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&str[i]);
i=0;
for(i=0;i<n;i++)
printf("%d\n",yin(str[i],2));
return 0;
}
int zhi(int a)
{
int k=2,flag=0;
for(k=2;k<=a/2;k++)
{
if(a%k==0)
{ flag=1;
break;
}
}
return flag;
}
int yin(int m,int t)
{
int j=t,c=0,b=0,x=0;
int str1[10000][2];
if(m<t&&m!=1)
return 0;
else if(m==1)
return 1;
else if(zhi(m)==0)
return 1;
else
for(j=t;j<=m;j++)
{
if(m%j==0)
{ str1[c][0]=m/j;
str1[c][1]=j;
c++;
}
}
for(b=0;b<c;b++)
{
x+=yin(str1[b][0],str1[b][1]);
}
return x;
}
|
1 | 149 |
int countt;
void f(int p,int q)
{
for(int m=p;m<=sqrt(q);m++)
{
if(q%m==0)
{countt++;
f(m,q/m);}
}
}
int main()
{
int n,num,i;
cin>>n;
for(i=0;i<n;i++)
{
cin>>num;
countt=0;
for(int k=2;k<=sqrt(num);k++)
{
if(num%k==0)
{
countt++;
f(k,num/k);
}
}
cout<<countt+1<<endl;;
}
return 0;
} |
1 | 150 | int ans = 0;
int work(int p,int k)
{ if (p==1) {ans++; return (p*k,k);}
for(int i =k;i <= p;i ++){
if(p % i == 0){
work(p / i,i);
}
}
}
int main()
{
int n;
scanf("%d",&n);
while(n--){
ans = 0;
int t;
scanf("%d",&t);
work(t,2);
//ans = work(t);
printf("%d\n",ans);
}
return 0;
} |
1 | 151 | struct node
{
int s,n;
};
void cpy_clr(struct node a[],struct node b[])
{
int i;
for(i=0;i<=MAX&&(a[i].s!=0||b[i].s!=0);i++)
if(b[i].s!=0)
{a[i].s=b[i].s;a[i].n=b[i].n;b[i].s=0;b[i].n=0;}
else
{a[i].s=0;a[i].n=0;b[i].n=0;}
}
int chklst(struct node a[],int n)
{
int i;
int result=0;
for(i=0;a[i].s!=0;i++)
{ if(a[i].s!=n){result=0;break;}
else result++;
}
return result;
}
void init(struct node a[])
{
int i;
for(i=0;i<MAX;i++) {a[i].s=0;a[i].n=0;}
}
void main()
{
struct node a[MAX],b[MAX];
int i,j,k,l,_n,n,sum=0;
scanf("%d",&n);
while(n--)
{
scanf("%d",&_n);
for(l=2;l<_n;l++)
if(_n%l==0)
{ init(a);init(b);
a[0].s=l;a[0].n=l;
while(chklst(a,_n)==0&&a[0].s!=0)
{
i=0;k=-1;
if(a[0].s==0) break;
while(a[i].s!=0)
{
if(a[i].s==_n) sum++;
else
{
for(j=a[i].n;j<=(_n/a[i].s);j++)
if(_n%(a[i].s*j)==0)
{b[++k].s=a[i].s*j;b[k].n=j;}
}
i++;
}
cpy_clr(a,b);
}
i=0;
while(a[i].s!=0)
{
if(a[i].s==_n) sum++;
i++;
}
}
printf("%d\n",++sum);
sum=0;
}
}
|
1 | 152 | int main()
{
int fj(int m,int min);
int t,i,a[100];
cin>>t;
for(i=1;i<=t;i++)
{
cin>>a[i];
cout<<fj(a[i],2)<<endl;
}
return 0;
}
int fj(int m,int min)
{
int counter=1;
int i;
if(m<min)
return 0;
for(i=min;i<m;i++)
if(m%i==0)
{
counter=fj(m/i,i)+counter;
}
return counter;
} |
1 | 153 | int varieties=0;//???????varieties???????
void factor(int,int);//?????
int main()//???
{
int n=0,num=0,i=0;//????
cin>>n;
for(i=1;i<=n;i++)//?????????????
{
varieties=0;
cin>>num;
factor(2,num);//????
cout<<varieties<<endl;
}
return 0;
}
void factor(int first,int num)//??factor????????????
{
int i=0;
if(num==1)//????
{
varieties++;
}
else
{
for(i=first;i<=num;i++)//??????1<a1<=a2<=...<=an???
{
if(num%i==0)
{
factor(i,num/i);
}
}
}
}
|
1 | 154 | int divide(int,int);
int main(void)
{
int n,a;
cin>>n;
while(n!=0)
{
cin>>a;
cout<<divide(a,2)<<endl;
n--;
}
return 0;
}
int divide(int x,int t)
{
int i,sum=0;
if(x==1) return 1; //????x?1
for(i=t;i<=x;i++)
{
if(x%i==0) sum+=divide(x/i,i); //?i?x????x/i???????????????i?
}
return sum;
}
|
1 | 155 | int num = 0, t = 2;
void detach(int n)
{
int i;
int q = t; // ?q???t??????
if (n == 1) // n?1?????1
{
num++;
}
else
{
for (i = t; i <= n / 2; i++) // ?t?n/2?????n??
{
if (n % i == 0)
{
n = n / i;
t = i; // ?????n??n/i?????i?n/2
detach(n); // ????
n = n * i; // ??n?t
t = q;
}
}
if (i > n / 2 && n >= t) // ???????????n = n???????
{
n = 1;
detach(n);
}
}
}
int main()
{
int n, a;
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> a; // ???????
detach(a); // ??????
cout << num << endl; // ??????
num = 0; // ????????0
t = 2;
}
return 0;
} |
1 | 156 | int number(int m,int x)
{
int a,b,c,n,l,k,r;
k=(int)sqrt(m);
if(x>m)
{
return 0;
}
else if(x>k)
{
return 1;
}
else
{
l=1;
for(a=x;a<=k;a++)
if(m%a==0)
l=l+number(m/a,a);
else;
return l;
}
}
main()
{
int n,a;
scanf("%d",&n);
for(a=1;a<=n;a++)
{
int m,b;
scanf("%d",&m);
b=number(m,2);
printf("%d\n",b);
}
} |
1 | 157 | /*
*????????.cpp
*?????
*????: 2012-11-25
*???????????????
*/
int b, j, f[1010];
void factorization(int x)
{
int now, i;
for (i = 2; i <= x; i++)
{
if (x % i == 0 && i >= f[j])
{
f[++j] = i;
now = x / i;
if (now == 1)
{
b++;
}
else
{
factorization(now);
}
j--;
}
}
return;
}
int main ()
{
int n, i, num;
cin >> n;
for (i = 0; i < n; i++)
{
b = 0;
j = 0;
memset (f, 0, sizeof(f));
cin >> num;
factorization(num);
cout << b << endl;
}
return 0;
}
|
1 | 158 | int g(int y)
{
int i;
for(i=0;;i++)
{
if(i*i>y)
break;
}
return i-1;
}
int f(int x,int b)
{
int p,a[100],t=0,k=0;
p=g(x);
if(x==2)
return 0;
else
{
for(int i=b;i<=p;i++)
{
if(x%i==0)
{
a[t]=i;
t++;
}
}
if(t==0)
return 0;
else
for(int i=0;i<t;i++)
k=k+f(x/a[i],a[i])+1;
return k;
}
}
int main()
{
int n,a;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a;
cout<<f(a,2)+1<<endl;
}
return 0;
} |
1 | 159 |
int chu(int i,int n);
int main()
{
int n,m,i,j;
int sum[100];
scanf("%d",&n);
for(i=0;i<=(n-1);i++)
{
scanf("%d",&m);
sum[i]=0;
for(j=2;j<=sqrt(m);j++)
{
if(m%j==0)
{
sum[i]+=chu(j,m/j);
}
}
}
for(i=0;i<=(n-1);i++)
{
printf("%d\n",sum[i]+1);
}
}
int chu(int i,int n)
{
int j,m,t;
t=1;
m=n;
for(j=i;j<=sqrt(m);j++)
{
if(m%j==0)
{
t+=chu(j,(m/j));
}
}
return t;
} |
1 | 160 | /****************************************
* ???? *
* *
* Created on: 2010-12-8 *
* Author:?? *
***************************************/
int factor(int x,int y) //?????????factor
{
int i;
for(i=2;i<x;i++) //?????x?????
{
if(x%i==0)
{
break;
}
}
if(i==x)
{
return 1; //??x??????1
}
else //????????????
{
int sum=0;
if(x==y) //?x?y?????y/x+1??????????????????????1???
{
for(i=y/x+1;i<=sqrt(x);i++) //?????????????????
{
if(x%i==0)
{
sum=sum+factor(x/i,x);
}
else continue;
}
return sum+1; //????sum+1?????????a=a???
}
else
{ //?x?y??????y/x?????????
for(i=y/x;i<=sqrt(x);i++)
{
if(x%i==0)
{
sum=sum+factor(x/i,x);
}
else continue;
}
return sum+1; //????sum+1?????????a=a???
}
}
}
int main() //?????
{
int n;
cin>>n;
const int m=n;
int a[m],j;
for(j=0;j<n;j++)
{
cin>>a[j]; //???????
}
for(j=0;j<n;j++)
{
cout<<factor(a[j],a[j])<<endl; //??????
}
return 0;
}
|
1 | 161 | int main()
{
int f(int k,int m);
int n;
scanf("%d",&n);
int i;
for(i=1;i<=n;i++)
{
int k;
scanf("%d",&k);
printf("%d\n",f(k,2));
}
return 0;
}
int f(int k,int m)
{
int i;
int j=0;
if(k<=m)
{
if(k==m){
j=1;
return j;
}
else
{
j=0;
return j;
}
}
else
{
for(i=m;i<=k;i++)
{
if(k%i==0&&k/i!=1)
j=j+f(k/i,i);
if(k%i==0&&k/i==1)
j=j+1;
}
return j;
}
} |
1 | 162 | void factor(int x,int limit);
int result;
int main()
{
int n;
scanf("%d",&n);
int input;
for(int i=0;i<=n-1;i++)
{
scanf("%d",&input);
result=1;//limit?2?????result=1;
factor(input,2);//limit?2?????result=1;
printf("%d\n",result);
}
return 0;
}
void factor(int x,int limit)
{
int remainder;
if(x<limit)
{
return;
}
for(int i=limit;i<=x;i++)
{
remainder=x%i;
if(remainder==0)
{
if(x/i>=i)
{
result++;
factor(x/i,i);
}
}
}
} |
1 | 163 |
int fenjie(int , int);
int fenjie(int q1, int n1)
{
int s1, i1;
if (q1 > n1)
return 0;
else
{
s1 = 0;
for (i1 = q1; i1 <= n1; i1++)
{
if ((i1 >= 2) && (n1%i1 == 0) && (n1/i1 >= i1))
{
s1++;
s1 = s1 + fenjie(i1, n1 / i1);
}
}
return s1;
}
}
int main()
{
int m, i, n;
cin >> m;
for (i = 1; i <= m; i++)
{
cin >> n;
cout << fenjie(1,n)+1 << endl;
}
return 0;
}
|
1 | 164 | void main()
{
int zy(int a,int b);
int j,n,m,sum;
scanf("%d",&n);
for(j=1;j<=n;j++)
{
scanf("%d",&m);
sum=zy(2,m);
printf("%d\n",sum);
}
}
int zy(int a,int b)
{
int i,c,t=1;
c=0;
if(a==0)
c=c+1;
else
{for(i=a;i*i<=b;i++)
{
if(b%i==0)
c=zy(i,(b/i))+c;
}
if(i*i>b)
c=c+1;}
return(c);
} |
1 | 165 | int t(int, int);
int s, j, k1;
int main()
{
int a, n, i;
cin >> n;
for (i = 1; i <= n; i++)
{
cin >> a;
s = 1;
k1 = 0;
for (j = 2; j <= sqrt((double) a); j++)
{
if (a % j == 0)
t(a / j, j);
}
cout << s << endl;
}
return 0;
}
int t(int a, int b)
{
int k;
for (k = b; k <= a; k++)
{
if (a % k == 0)
{
if (a / k == 1)
{
s = s + 1;
break;
}
t(a / k, k);
}
}
return 0;
} |
1 | 166 | int a;
int fj(int x, int y);
int main()
{
int n;
cin >> n;
int i;
for (i = 1; i <= n; i++)
{
cin >> a;
cout << fj(a, 2) << endl;
}
return 0;
}
int fj(int x, int y)
{
int xnumber = 1;
int i;
int b = sqrt(x);
if (x == 1) return 0;
else
for (i = y; i <= b; i++)
{
if (x % i == 0) xnumber = xnumber + fj(x / i, i);
}
return xnumber;
} |
1 | 167 | //*************************************************
//*file: 1000012912_006.cpp *
//*author: ??? *
//*date?2010.12.01 *
//*function????? *
//*************************************************
int sum(int); //sum??????????a=a?
int g_count, g_j; //count???-1,j?????
int main()
{
int n, a, i; //n????a?????
cin >> n;
for ( i = 0; i < n; i ++ )
{
g_count = 0;
g_j = 2;
cin >> a;
cout << sum(a) + 1 << endl;
}
return 0;
}
int sum( int a)
{
int i, b;
b = (int)sqrt( (double)a );
for ( i = g_j; i <= b; i++ )
{
if ( a % i == 0 ) //?a??i????????????1
{
g_j = i; //j??i???????
g_count++;
sum( a / i );
}
}
return g_count;
}
|
1 | 168 | /*
* hanshu_huisu_1.cpp
* Name?????
* Created on: 2010-12-7
* Author: ??
*/
int n,c;
int solutionnumber(int n,int c){//n?????,c???
if(n==c) return 1;//?n=c???????????????????????1
if(n<c) return 0;//??n<c?????????0
if(n%c==0) return solutionnumber(n/c,c)+solutionnumber(n,c+1);/*?n??c???????
???c????????????n???c???????*/
else return solutionnumber(n,c+1);
}
int main(){
int N,a;
cin>>N;//?????????
while(N>0){
cin>>a;//??????
cout<<solutionnumber(a,2)<<endl;//?????????
N--;
}
return 0;
}
|
1 | 169 | int f(int x,int y)
{
if(y==x)
return 1;
if(y>x)
return 0;
if(x%y==0)
return f(x,y+1)+f(x/y,y);
else
return f(x,y+1);
}
int main()
{
int n,x;
cin>>n;
int z,i;
i=n;
while(i>0)
{
i=i-1;
cin>>x;
z=f(x,2);
cout<<z<<endl;
}
return 0;
}
|
1 | 170 | int fenjie(int x,int k)
{
int t=1,i;
if(k>x)
{
return 0;
}
for(i=k;i<x;i++)
{
if(x%i==0)
{
t=t+fenjie(x/i,i);
}
}
return t;
}
int main()
{
int j,p,n,a[101];
scanf("%d",&n);
for(j=0;j<=n-1;j++)
{
scanf("%d",&a[j]);
}
for(j=0;j<=n-1;j++)
{
printf("%d",fenjie(a[j],2));
printf("\n");
}
return 0;
} |
1 | 171 | //*************************************
// ????**
// ?? 1200012872**
// 2012.11.27**
//*************************************
int factorization(int a, int k);
int main()
{
int n, a;
cin >> n;
for (int i = 0; i < n; i++) //??????????????
{
cin >> a;
cout << factorization(a, 2) << endl;
}
return 0;
}
int factorization(int a, int k)
{
int sum = 1; //???????
if (a == 1) //??a?1?????
{
return 0;
}
if (a == 2) //??a?2???????
{
return 1;
}
int b = (int) sqrt ((double)a); //?b?a??????
for (int i = k; i <= b ; i++) //??a???i??????????????????
{
if (a % i == 0)
{
sum += factorization(a / i, i);
}
}
return sum; //??sum?
}
|
1 | 172 |
int factor(int a,int min)
{
int count=0;
for(int i=min;i<=a;i++)
{
if(i==a)
{
count+=1;
}
if(a%i==0)
{
count+=factor(a/i,i);
}
}
return count;
}
int main()
{
int n;
cin>>n;
while(n--)
{
int a;
cin>>a;
int result=factor(a,2);
cout<<result<<endl;
}
return 0;
}
|
1 | 173 | int qipa(int p,int q) // ?p???????????q??????
{
int i,l,s=0;
if(p==1) return 1;
for(i=p;i>1;i--)
if(p%i==0 && i<=q)
s+=qipa(p/i,i);
return s;
}
int main()
{
int i,j,n,m,t;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&m);
t=qipa(m,m);
printf("%d\n",t);
}
return 0;
} |
1 | 174 | int main()
{
int func(int a,int b);
int n;
cin>>n;
while(n--){
int number;
cin>>number;
cout<<func(number,number)<<endl;
}
return 0;
}
int func(int a,int b)
{
if(a==1){
return 1;
}
if(b==1){
return 0;
}
if(a%b==0){
return func(a/b,b)+func(a,b-1);
}
return func(a,b-1);
} |
1 | 175 | int sum=0;
int main()
{ void shu(int a,int b);
int n=0,i=0,a=0,c=0,j=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{ scanf("%d",&a);
for(j=2;j<=sqrt((double)a);j++)
{ if(a%j==0)
{ sum=sum+1;
shu(j,a/j);
}
}
printf("%d",sum+1);
if(i<n)
printf("\n");
sum=0;
}
return(0);
}
void shu(int a,int b)
{ int i=0;
for(i=a;i<=sqrt((double)b);i++)
{ if(b%i==0)
{ sum=sum+1;
shu(i,b/i);
}
}
} |
1 | 176 | int fenjie(int n,int x){
int i,t=0; //t??? ???
for(i=x;i<=sqrt(n);i++){
if(n%i==0){
t=t+1+fenjie(n/i,i); //???????? ????????
}
}
return t; //???????????0
}
int main(){
int i,t,n;
cin>>t;
for(i=0;i<t;i++){ //????
cin>>n;
cout<< fenjie(n,2)+1<<endl;}
return 0;
}
|
1 | 177 | int factor(int N,int min)
{
int result=1,i;
if(N<min)
{
return 0;
}
for(i=min;i<N;i++)
{
if(N%i==0)
{
result+=factor(N/i,i);
}
}
return result;
}
main()
{
int n=0,i=0,x=0,y=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&x);
y=factor(x,2);
printf("%d\n",y);
}
return 0;
}
|
1 | 178 | int sum=0;//???????????
void fact(int a,int i)//?????;??????????a?????i?????
{
if(a==1) sum++;//???????N=1????????N????????1
while(i<=a)//????i???N
{
if(a%i==0) fact(a/i,i);//??N??i?????????????N/i??
i++;//??N???i???i?1
}
}
int main()//???
{
int n;//?????????
cin>>n;//??????
while(n--)//??
{
int a;//??????????
cin>>a;//????
int i=2;//???????2?
int result=1;//????????a??????
while(i<=a/2)//??i???a???
{
if(a%i==0)//??i?a???
{
sum=0;//sum??
fact(a/i,i);//????????/i
result+=sum;//????????i????
}
i++;//i?1
}
cout<<result<<endl;//??????
}
return 0;
}
|
1 | 179 | int d(int,int);
int main()
{
int i,n,x;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>x;
cout<<d(x,2)<<endl;
}
return 0;
}
int d(int x,int y)
{
int j,num=1;
if(x==1)
return 0;
if(x==2)
return 1;
for(j=y;j<=(int)sqrt((double)x);j++)
if(x%j==0)
num+=d(x/j,j);
return num;
}
|
1 | 180 | /*
* factorization.cpp
* ?? - 1090 ????
* ???????a?????????????????a = a1 * a2 * a3 * ... * an?
* ??1 < a1 <= a2 <= a3 <= ... <= an?????????????????a = a???????
* Created on: 2013-11-20
* Author: ???
*/
int k , a; // ?? k
void find(int i , int x){ // ??????
for(int j = i; j * j <= x && i != 1; j ++) // ? j² > x, ???????????? i ? 1, ?????
if(x / j * j == x){ // ? k ??? j ??????????????????
find(j , x / j);
k ++;
} // End if
// End for
} // End find
int main(){
int n;
for(cin >> n; n --; ){
k = 0;
cin >> a;
find(2 , a);
cout << ++ k << endl; // ?? a = a ?????????
} // End for
return 0;
}
|
1 | 181 | int sum=0; //?????????????
void ways(int a,int last);
int main()
{
int n,num[100],i;
cin>>n;
for(i=0;i<n;i++)
{
cin>>num[i];
}
for(i=0;i<n;i++)
{
ways(num[i],2); //??????????
cout<<sum<<endl; //??
sum=0;
}
return 0;
}
void ways(int a,int last)
{
int i,j;
for(i=last;i<=a;i++)
{
if(a<i) //????????????????????????
{
}
else if(a==i) //???????????u?????
{
sum++;
}
else if(a%i==0) //????????????????????????????????
{
ways(a/i,i);
}
}
}
|
1 | 182 | int j;
int discharge(int x,int y)
{
int a=1;
for(int i=y;i<=(sqrt((double)x));i++)
{
if(x%i==0)
{
a=a+discharge(x/i,i);
}
}
return a;
}
int main()
{
int n,x,r[100];
cin>>n;
for(j=0;j<n;j++)
{
cin>>x;
r[j]=discharge(x,2);
}
for(j=0;j<n-1;j++)
{
cout<<r[j]<<endl;
}
cout<<r[n-1];
return 0;
} |
1 | 183 | int f(int t)
{
double v=sqrt(t)+1;
for(int i=2; i<v; i++)
if(t%i==0) return 0;
return 1;
}
int sum=0;
void fun(int n,int i)
{
if(n==1)
sum++;
while(i<=n)
{
if(n%i==0)
fun(n/i,i);
i++;
}
return ;
}
int main()
{
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
int a;
scanf("%d",&a);
if(f(a)>0)
{
printf("1\n");
continue;
}
int i=2,K=1;
while(i<=a/2)
{
if(a%i==0)
{
sum=0;
fun(a/i,i);
K+=sum;
}
i++;
}
printf("%d\n",K);
}
} |
1 | 184 | int dividemin(int a,int minyinzi){
int num=0;
if(a==1)num++;
else for(int i=minyinzi;i<=a;i++)
{
if(a%i==0)num=num+dividemin(a/i,i);
}
return num;
}
int main(){
int n;
cin>>n;
int a[n];
for(int i=0;i<=n-1;i++)
cin>>a[i];
for(int i=0;i<=n-1;i++)
//cout<<divide(a[i],a[i])<<endl;
cout<<dividemin(a[i],2)<<endl;
} |
1 | 185 |
int f(int,int);
int main()
{
int N;
cin>>N;
int i;
for(i=1;i<=N;i++)
{
int a;
cin>>a;
cout<<f(a,2)<<endl;
}
return 0;
}
int f(int n,int m)
{
int j;
int number=1;
for(j=m;j<=(int)sqrt(n);j++)
{
if(n%j==0)
{
number=number+f(n/j,j);
}
}
return number;
}
|
1 | 186 | int a=0,s=0;
void find(int n,int prim)
{
if (n==a){s++;}
else
{
for (int i=prim;i<=a/n;i++)
if ((a%(n*i)==0)){find(n*i,i);}
}
}
int main()
{int n=0;cin>>n;
for (int i=1;i<=n;i++)
{
cin>>a;s=0;
for (int i=2;i<=a;i++)
{
if (a%i==0) {find(i,i);}
}
cout<<s<<endl;
}
return 0;
}
|
1 | 187 | int f(int a,int min){
if(a<min)
return 0;
int sum=1;
for(int i=min;i<a;i++){
if(a%i==0)
sum+=f(a/i,i);
}
return sum;
}
int main(){
int n;
int a[100];
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
a[i]=f(a[i],2);
}
for(int i=0;i<n;i++){
printf("%d\n",a[i]);
}
return 0;
}
|
1 | 188 |
int f(int q,int x)
{
if(q<x)
{ int i,k,p,sum;
k=0;sum=0;p=0;
for(i=2;i<=x/2;i++)
if(x%i==0) k=k+1;
if(k==0) return 1;
else
{ for(i=2;i<=sqrt(x);i++)
{ if(x%i==0)
{ if(i<q) continue;
else sum=sum+f(i,x/i);
}
}
return sum+1;
p=0;
sum=0;
}
}
else
{ if(q==x) return 1;
else
return 0;
}
}
//???
int main()
{
int n,i,x,sum,p;
p=0;
sum=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&x);
sum=f(2,x);
printf("%d\n",sum);
}
return 0;
} |
1 | 189 | int get(int n,int m)//??????????????????n??????m??????
{
if(n==1)return 1;//??n?1???????????1???
while(m>=2)//?m?????????????????????????????????????
{
if(n%m==0)break;
--m;
}
if(m==1)return 0;//??m?1??????????
return get(n/m,m)+get(n,m-1);//?????????????????????????????????????n/m??????????
}
int main()
{
int t;
cin>>t;
for(int i=0;i<t;++i)
{
int n;
cin>>n;
cout<<get(n,n)<<endl;
}
return 0;
}
|
1 | 190 | int su(int input)//?????????
{
int ju=1;
for(int i=2;i<sqrt(input);i++)
{
if(input%i==0) ju=0;
break;
}
return ju;
}
int fenjie(int input, int k)//k???????????input??????
{
int ret=1;//re??????????????
for(int i=k;i<=sqrt(input);i++)
{
if(input%i==0)
{
if(su(input/i)==0);//????????????????????
{
ret=fenjie(input/i,i)+ret;
}
}
}
return ret;
}
int main()
{
int input,num,sol;
cin>>num;
while(num--)//????
{
cin>>input;
cout<<fenjie(input,2)<<endl;//sol??????????
}
return 0;
}
|
1 | 191 | void main()
{
int n,a[100],i;
void fen(int a[],int x);
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
fen(a,n);
}
void fen(int a[],int x)
{
int k,b=2,c,t;
int look(int x,int y);
for(k=0;k<x;k++)
{
c=a[k];
t=look(c,b);
printf("%d\n",t);
}
}
int look(int x,int y)
{
int total=1,p;
if(x/y==0)
{ return 0;}
else
{
for(p=y;p<x;p++)
{
if(x%p==0)
{
total=total+look(x/p,p);
}
}
}
return total;
} |
1 | 192 | int min(int a,int b)
{
if(a>=b)
return b;
else
return a;
}
int f(int a,int b)
{
int count=0;
int k[32768]={0};
if(a==1)
return 1;
else
{
int i,j;
for(i=min(a,b);i>=2;i--)
{
if(a%i==0)
k[i]=i;
}
for(j=0;j<32768;j++)
{
if(k[j]!=0)
{
count=count+f(a/k[j],j);
k[j]=0;
}
}
return count;
}
}
main()
{
int n,i,a,number;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a);
number=f(a,a);
printf("%d\n",number);
}
}
|
1 | 193 |
int cut(int m,int l){
int sum=1;
for(int i=l;i<=sqrt((double)m/l);i++){
if((m/l)%i==0){
sum+=cut(m/l,i);
}
}
return sum;
}
int main (){
int n;
cin>>n;
for(int i=0;i<n;i++){
int t=0;
cin>>t;
cout<<cut(2*t,2);
if(i<n-1) cout<<endl;
}
}
|
1 | 194 | int s(int, int);
int main()
{
int n, i, a;
cin >> n;
for(i = 0;i < n;i++)
{
cin >> a;
cout << s(a, 2) << endl; // ??????b????2
}
return 0;
}
int s(int a, int b)
{
int i, t = 0;
for(i = b;i < a;i++)
if(a % i == 0 && a / i >= i) // ????????????????
t = t + s(a / i, i); // ????????????
return t + 1;
} |
1 | 195 | int n;
void count(int x,int y)
{
int i;
if(x==1) n=n+1;
else
{
for(i=y;i<=x;i++)
{
if(x%i==0) count(x/i,i);
}
}
}
int main()
{
int i,k,t;
void count(int x,int y);
scanf("%d",&k);
for(i=0;i<k;i++)
{
n=0;
scanf("%d",&t);
count(t,2);
printf("%d\n",n);
}
return 0;
} |
1 | 196 | int fib(int a,int e);
int main(){
int n,b,i;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d",&b);
printf("%d\n",fib(b,2));
}
scanf("%d",&n);
return 0;
}
int fib(int a,int e){
int j,c,d;
c=1;
if(a<=e) return 1;
for(j=e;j<=sqrt(a);j++){
if(a%j==0){
d=a/j;
c=c+fib(d,j);
}
}
return c;
}
|
1 | 197 | int num=0;
void yinshu(int x,int y)
{
if (x==y) num++;
else if ((x%y==0)&&(x>y)) {yinshu(x/y,y);yinshu(x,y+1);}
else if (x>y) yinshu(x,y+1);
}
int main()
{
int n,x;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>x;
yinshu(x,2);
cout<<num<<endl;
num=0;
}
}
|
1 | 198 | int main()
{
int nFactor(int n, int border);
int n;
cin >> n;
for (; n >= 1; n--)
{
int a;
cin >> a;
cout << nFactor(a, a) << endl;
}
return 0;
}
int nFactor(int n, int border)
{
if (n == 1) return 1;
else
{
int i, sum = 0;
for (i = border; i >= 2; i --)
{
if (n % i == 0)
sum += nFactor(n / i, i);
}
return sum;
}
}
|
1 | 199 | int f(int a,int min)
{
int result=1,i;
if(a<min)
return 0;
else
{
for(i=min;i<=a;i++)
{
if(a%i==0)
{
result+=f(a/i,i);
}
}
return result;
}
}
int main()
{
int n,a,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a);
printf("%d\n",f(a,2));
}
return 0;
} |