label
stringlengths 1
2
| index
stringlengths 1
5
| code
stringlengths 87
8.24k
|
---|---|---|
1 | 400 | int decomposition(int m,int k){
int res=1;
for(int i=k;i*i<=m;i++){
if(m%i==0&&m/i>=i){
res+=decomposition(m/i,i);
}
}
return res;
}
int main(){
int n;
while(scanf("%d",&n)==1){
for(int i=0;i<n;i++){
int m;
scanf("%d",&m);
printf("%d\n",decomposition(m,2));
}
}
return 0;
} |
1 | 401 |
int f(int a,int min)
{
if(a < min)
{
return 0;
}
int r= 1;
for(int i = min;i<a;i++)
{
if(a%i == 0)
{
r+= f(a/i,i);
}
}
return r;
}
main()
{
int n,a,i,j=0,k,m=0,r=0;
scanf("%d",&n);
for(k=0;k<n;k++)
{
scanf("%d",&a);
if(k!=n-1)
printf("%d\n",f(a,2));
else
printf("%d",f(a,2));
}
} |
1 | 402 | int a=1;
int yinzi(int j,int n)
{
for(int i=j;i<n;i++)
{
if(n%i==0&&n!=i&&n/i>=i)
{
a++;
yinzi(i,n/i);
}
}
return 0;
}
int main()
{
int n,s;
cin>>s;
for(int j=0;j<s;j++)
{
cin>>n;
for(int i=2;i<=n;i++)
{
if(n%i==0&&n/i>=i)
{
a++;
yinzi(i,n/i);
}
}
cout<<a<<endl;
a=1;
}
return 0;
} |
1 | 403 | int f(int x,int y) //???????????????y?????????x????????
{int i,num=0;
int a[100];
int sum=0;
for(i=x;i<=sqrt(y);i++){
if(y%i==0) {num++;a[num]=1+f(i,y/i);}} //??????
for(i=1;i<=num;i++) {sum=sum+a[i];}
return sum;
}
int main(){
int n,x,i,b[100];
cin>>n; //?????????
for(i=1;i<=n;i++){cin>>x;b[i]=x;}
for(i=1;i<=n;i++){cout<<f(2,b[i])+1<<endl;} //???????
return 0;
} |
1 | 404 | int sum=1;
void f(int i,int j)
{
int k;
if(i==1)
sum++;
else
{
for(k=j;k<=i;k++)
{
if(i%k==0)
f(i/k,k);
}
}
}
int main(void)
{
int i,j,k;
int n;
int a;
scanf("%d",&n);
while(n--)
{
sum=1;
scanf("%d",&a);
for(i=2;i*i<=a;i++)
{
if(a%i==0)
{
f(a/i,i);
}
}
printf("%d\n",sum);
}
return 0;
} |
1 | 405 | int main()
{
int f(int a,int b);
int n,m,i,d;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&m);
d=f(m,2);
printf("%d\n",d);
}
return 0;
}
int f(int a,int b)
{
int t=1,k,j;
for(j=b;j<a;j++)
{
if(a%j==0&&a/j>=j)
k=f(a/j,j);
else
k=0;
t=t+k;
}
return t;
} |
1 | 406 |
int a;
int m=0,s=1;
void temp(int b,int k,int c)
{
for(int i=k;i<=b;i++)//????
{
if(b%i==0)
{
b=b/i;
s=s*i;
k=i;
if(s==c)
{
m++;
}
else
temp(b,k,c);
s=s/i;//??
b=b*i;
}
}
}
int main()
{
int n,a,i;
cin>>n;
for(i=0;i<n;i++)
{
cin>>a;
temp(a,2,a);//??
cout<<m<<endl;
m=0;
}
return 0;
} |
1 | 407 | void main()
{
int f(int x,int m);
int k,i,j,n,sum=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&k);
for(j=2;j<=k;j++)
{
if(k%j==0)
{
sum+=f(k,j);
}
}
printf("%d\n",sum);
sum=0;
}
}
int f(int x,int m)
{
int i,sum=0;
if(m==x)
sum=1;
else
{
x=x/m;
for(i=m;i<=x;i++)
{
if(x%i==0)
{
sum+=f(x,i);
}
}
}
return sum;
} |
1 | 408 | int meide(int x,int y)
{
int sum=1,count=0,i;
for(i=y;i<=sqrt(x);i++)
{
if(x%i==0)
{
sum=sum+meide(x/i,i);
}
}
return sum;
}
int main()
{
int k,n,m;
scanf("%d",&k);
for(m=0;m<k;m++)
{
scanf("%d",&n);
if(n>=3)
{
printf("%d\n",meide(n,2));
}
else
{
printf("1\n");
}
}
return 0;
}
|
1 | 409 | int s=0,p;
int a[100];
void factor(int m,int n,int t){
int i;
for(i=2;i<=(int)sqrt(n);i++)
if((n%i==0)&&(i>=m)){
s++;
factor(i,n/i,t+1);
}
return;
}
int main(){
int i,j=0,k;
scanf("%d",&j);
for(k=0;k<j;k++)
scanf("%d",&a[k]);
for(k=0;k<j;k++){
p=a[k]; s=0;
for(i=2;i<=(int)sqrt(p);i++)
if(p%i==0){
s++;
factor(i,p/i,2);
}
a[k]=s;
}
for(k=0;k<j;k++)
printf("%d\n",a[k]+1);
return 0;
} |
1 | 410 | /*
* ????apple.cpp
* ???00948343_??
* ?????2012/11/19
* ???????
*/
int fenjie(int a, int start);
int main(){
int n, i, integ;
cin >> n;
for (i=0;i<n;i++){
cin >> integ;
cout << fenjie(integ, 2) << endl;
}
return 0;
}
int fenjie(int a, int start){
int i, sum=1;
if (start==a)
sum=1;
else{
for (i=start;i<=sqrt(a);i++){
if (a%i==0){
sum = sum + fenjie(a/i, i);
}
}
}
return sum;
}
|
1 | 411 | // ????2.cpp : ??????????????
//
void out( int,int );
int t = 1;
int main()
{
int n = 0;
int i = 0;
double sum = 0;
cin >> n;
for( i = 1;i <= n;i++ )
{
cin >> sum;
out(sum,2.0);
cout << t << endl;
t = 1;
}
cin >> i;
return 0;
}
void out(int sum,int q )
{
int num = 0;
double m = sum;
num = sqrt(m);
if( sum % q == 0 && q <= num )
{
t++;
out( sum / q,q );
out( sum,q + 1 );
}
if( sum % q != 0 && q <= num )
out( sum,q + 1);
}
|
1 | 412 | //* * * * * * * * * * * * * * * * * * * * * * * *
//*???????? *
//*???????? .cpp *
//*????? 1000012839 *
//*???2010.12.04 *
//* * * * * * * * * * * * * * * * * * * * * * * *
int ways(int a, int min); // ????ways?????????a??????,a??????min?
int main()
{
int n, a, i, sum = 0, k, min; // n?????????,a????????????i,k?a??????min??????sum?
cin >> n;
for (i = 0; i < n; i++)
{
cin >> a;
sum = 0;
for (k = 2; k <= a; k++)
{
if (a % k == 0)
{
min = k;
break;
}
} // ???????
if (a != min)
sum = ways(a, min); // ??a??????????
else
sum = 1; // ??a?????????????
cout << sum << endl;
}
return 0;
}
int ways(int a, int min)
{
int result = 1, i; // result????1??a = a???,i??????
if(a < min)
return 0; // ?????????????
for (i = min; i < a; i++)
{
if (a % i == 0)
result += ways(a / i, i); // ?????i??a/i????????????
}
return result;
}
|
1 | 413 |
int main()
{
int depart (int number, int y);
int i, n, number;
cin >> n;
for (i = 1; i <= n; i++)
{
cin >> number;
cout << depart (number, 2) << endl;
}
return 0;
}
int depart (int number, int y)
{
int count = 1, a, i;
if (number == 1)
return 0;
if (number == 2)
return 1;
else
a = sqrt( number);
for (i = y; i <= a; i++)
if (number % i == 0)
count += depart (number / i, i);
return count;
}
|
1 | 414 | int f(int n,int i)
{
int sum=0;
for(i;i<=(int)sqrt(n);i++){
if(n%i==0) {
sum+=f(n/i,i);
}
}
return sum+1;
}
main()
{
int i0,n0;
scanf("%d",&n0);
for(i0=0;i0<n0;i0++){
int n;
scanf("%d",&n);
printf("%d\n",f(n,2));
}
}
|
1 | 415 |
int counter=1;//???????????
void abc(int a,int b)
{
int i;
for(i=b;i<=a;i++)//???????????
{
if(a%i==0&&(a/i)>=i)//????????????????????????????????????
{
counter++;
abc(a/i,i);
}
}
}
int main()
{
int t,x;
cin>>t;
for(x=1;x<=t;x++)//?????????????????
{
counter=1;//??????????????????????????????????????????
int m;
cin>>m;//????
abc(m,2);//????
cout<<counter<<endl;//?????
}
return 0;
}
|
1 | 416 | void find(int m,int j,int *p)
{
for(;j<=m;j++)
{
if(m==j)
{
(*p)++;
break;
}
if(m%j==0) find(m/j,j,p);
}
}
int main()
{
int n,m,i,j;
scanf("%d",&n);
for(i=0;i<n;i++)
{
int count=0;
int *p;
p=&count;
scanf("%d",&m);
find(m,2,p);
printf("%d\n",count);
}
return 0;
}
|
1 | 417 |
int f(int a,int b)
{
if(a < b)
return 0;
int i,r =1 ;
for(i = b; i <= a; i++ )
{
if( !(a%i) && i <= a/i )
{
r += f(a/i,i);
}
}
return r;
}
void main()
{
int n,m;
scanf("%d",&n);
while(n--)
{
scanf("%d",&m);
int result = f(m,2);
printf("%d\n",result);
}
}
|
1 | 418 |
int s(int a,int b)
{ int sum=0,z=0;
if(a!=1&&b<=a)
{
for(int i=b;i<=a;++i)
{
if(a%i==0)
{
sum+=s(a/i,i);z=1;
}
}
}
else if(a==1)
return 1;
return sum;
}
int main()
{
int n,a;
cin>>n;
for(int i=0;i<n;++i)
{
cin>>a;
cout<<s(a,2)<<endl;
}
return 0;
}
|
1 | 419 | void main()
{
int f(int ,int );
int n[100],sum,i,m;
scanf("%d",&m);
for(i=0;i<m;i++)
scanf("%d",&n[i]);
for(i=0;i<m;i++)
{
sum=f(1,n[i])+1;
printf("%d\n",sum);
}
}
int f(int i,int n)
{
int j,k,sum=0;
for(j=i;j<(int)sqrt((double)n)+1;j++)
{
k=sum;
if(j==1)sum=0;
else
{
if(n%j==0&&n/j>=j)
{
sum=f(j,n/j)+1;
}
else sum=0;
}
sum=sum+k;
}
return(sum);
}
|
1 | 420 | int n,i;//???? n ???????
int f(int a,int min){ //??????f ?????a n
if(a < min){ //?????a ??n
return 0; //????0? ???????????
}
int result = 1; //??????? ???1
for(int i = min;i<a;i++){ //for?? ? ??????a
if(a % i == 0){ //?a???i???
result += f(a/i,i); //???? ??result
}
}
return result; //??????
}
int main(){ //?????
cin>>n;//??????
int a[n];
for(i=0;i<n;i++){ //????
cin>>a[i];
}
for(i=0;i<n;i++){
cout<<f(a[i],2)<<endl; //?????????? ????
}
return 0;
} |
1 | 421 | int f(int N, int min)
{
int s=1, i;
if(N < min)
return 0;
for(i = min; i < N; i++ )
{
if(N%i==0)
{
s += f(N/i, i);
}
}
return s;
}
int main()
{
int n, i, b = 2;
int a[100];
scanf("%d", &n);
for(i = 0; i < n; i++)
scanf("%d", &a[i]);
for(i = 0; i < n; i++)
printf("%d\n", f(a[i], b));
return 0;
} |
1 | 422 | int times=1;
int used[1000]={0};
void fuck(int n)
{
int i=0;
for (i=2;i<=sqrt(n);i++)
{
if (used[i]==0&&n%i==0)
{
int j=0;
for (j=0;j<=i-1;j++)
used[j]=1;
times++;
fuck(n/i);
for (j=0;j<=i-1;j++)
used[j]=0;
}
}
}
int main()
{
int n=0;
int num=0;
cin>>n;
int i=0;
for (i=0;i<n;i++)
{
cin>>num;
fuck(num);
cout<<times<<endl;
times=1;
int k=0;
for (k=0;k<=999;k++)
used[k]=0;
}
return 0;
} |
1 | 423 | /*
* wanyi.cpp
*
* Created on: 2012-11-20
* Author: 7
*/
int t=1;
void fen(int n,int i)
{
for(i=i;i*i<=n;i++)
{
if(n%i==0)
{
fen(n/i,i);
t++;
}
}
}
int main()
{
int k;
cin>>k;
while(k--)
{
int n;
cin>>n;
t=1;
fen(n,2);
cout<<t<<endl;
}
}
|
1 | 424 | int dfs(int k, int b) {
int ret=(k==1),i;
for (i=b;i<=k;i++)
if (k%i==0)
ret+=dfs(k/i,i);
return ret;
}
int main() {
int n, k;
cin>>n;
for (int i=1;i<=n;i++) {
cin>>k;
cout<<dfs(k,2)<<endl;
}
return 0;
}
|
1 | 425 | int sum=0;
void divide(int n,int a)
{
for(int i=a;i<=n;i++)
{
if((n%i==0))
{
if(n/i==1)
sum++;
else
divide(n/i,i);
}
}
}
int main()
{
int N=0,n=0,i=0;
cin>>N;
for(i=0;i<N;i++)
{
cin>>n;
divide(n,2);
cout<<sum<<endl;
sum=0;
}
return 0;
} |
1 | 426 | int func(int m,int q)
{
int b[100];
int i,j,k=0,p=0,sum=1;
for (j=q;j<=m;j++)
{
if (j*j>m)
{
p=k;
break;
}
if (m%j==0)
{
b[k]=j;
k++;
}
}
if (k>2||p!=0&&m!=2)
{
for (i=0;i<p;i++)
{
sum+=func(m/b[i],b[i]);
}
return (sum);
}
else
return (1);
}
main()
{
int i,j,k=0,n,m,b[100]={0},a[100]={0};
scanf("%d",&n);
for (i=0;i<n;i++)
{
scanf("%d",&m);
b[i]=func(m,2);
}
for (j=0;j<i;j++)
{
printf("%d\n",b[j]);
}
} |
1 | 427 |
int m,n,num;
void dfs(int i,int j)
{
int x;
if (i==1)
{
num++;
return;
}
for (x=j;x<=i;x++)
if (i%x==0)
dfs(i/x,x);
}
int main()
{
cin>>m;
while(m>0){
num=0;
cin>>n;
dfs(n,2);
cout<<num<<endl;
m--;
}
} |
1 | 428 | int fenjie(int a,int b)
{
int i,sign=0,k=0;
if(a<b) return 0;
else if(a==b) return 1;
else
{
for(i=2;i<=a-1;i++)
{
if(a%i==0)
sign=1;
}
if(sign!=1) return 1;
else
{
for(i=b;i<=a;i++)
{
if(a%i==0)
k+=fenjie(a/i,i);
}
k+=1;
return k;
}
}
}
int main()
{
int n,a[100],i,k;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&k);
printf("%d\n",fenjie(k,2));
}
return 0;
}
|
1 | 429 |
int count(int x,int y)//?????????
{
if(x<y) return 0;//????
if(x>=y)
{
int sum=0;
for(int j=y;j<x;j++)
{
if(x%j==0)
sum=sum+count(x/j,j);//???
}
return sum+1;
}
}
int main()
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=0;i<n;i++)
cout<< count(a[i],2) <<endl;
return 0;
}
|
1 | 430 | int sum=0;
int geshu(int a,int x)
{
int y,z;
z=a;
y=(int)sqrt(a);
while(x<=y)
{
if(a%x==0)
{
a=a/x;
geshu(a,x);
}
if(a==z/x)
a=z;
x++;
}
sum++;
return sum;
}
int main()
{
int n,i,a[100],b[100],x;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(a[i]==2||a[i]==3)
b[i]=1;
else
{
sum=0;
x=2;
b[i]=geshu(a[i],x);
}
}
for(i=0;i<n;i++)
{
printf("%d\n",b[i]);
}
} |
1 | 431 | int fun(int i,int j,int count)
{
int k;
for (k=i;k<=sqrt(j);k++)
if(j%k==0)
{
count++;
count=fun(k,j/k,count);
}
return count;
}
int main()
{int count;
int k,n,i,j;
scanf("%d",&k);
for(j=0;j<k;j++)
{
scanf("%d",&n);
count=1;
for(i=2;i<sqrt(n);i++)
if(n%i==0)
{
count++;
count=fun(i,n/i,count);
}
printf("%d\n",count);
}
return 0;
} |
1 | 432 | 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 ;
}
int main()
{
int m,x,j,k;
scanf ( "%d", &m );
for( j = 1;j <= m; j++ )
{
scanf ( "%d", &x );
k = factor ( x, 2);
printf ( "%d\n", k);
}
return 0;
} |
1 | 433 | int divide(int n,int j)
{
int sum=1,i,s,p,k;
s=sqrt(n);
for(i=j;i<=s;i++)
{
if (n%i==0)
{
p=n/i;
k=i;
sum=sum+divide(p,i);
}
}
return sum;
}
int main()
{
int n;
cin>>n;
int k,m,p;
for(k=0;k<n;k++)
{
cin>>m;
p=divide(m,2);
cout<<p<<endl;
}
return 0;
}
|
1 | 434 | int factorization(int num, int i);
int main()
{
int n, i, num;
cin >> n;
for (i = 0; i < n; i++)
{
cin >> num;
cout << factorization(num, 2) << endl;
}
return 0;
}
int factorization(int num, int i)
{
int j, squ, sum = 1;
squ = sqrt((double) num);
for (j = i; j <= squ; j++)
{
if (num % j == 0)
sum = sum + factorization(num / j, j);
}
return sum;
}; |
1 | 435 | int f(int a,int min)
{
int i,result;
if(a<min)
return 0;
result=1;
for(i=min;i<a;i++)
if(a%i==0)
result+=f(a/i,i);
return result;
}
int main()
{
int i,n,num[100];
cin>>n;
for(i=0;i<n;i++)
{
cin>>num[i];
cout<<f(num[i],2)<<endl;
}
return 0;
}
|
1 | 436 | 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;
}
int main(){
int n,m,j,re;
scanf("%d",&n);
for(j=0;j<n;j++){
scanf("%d",&m);
re=factor(m,2);
printf("%d\n",re);
}
scanf("%d",&n);
return 0;
}
|
1 | 437 | int Digui(int a,int min)
{
int i,result=1;
if(a<min)
{
return 0;
}
for(i=min;i<a;i++)
{
if(a%i==0)
{
result+=Digui(a/i,i);
}
}
return(result);
}
int main()
{
int a[1000],n,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
printf("%d\n",Digui(a[i],2));
}
return 0;
}
|
1 | 438 | int num;//num????????
int main()
{
int f(int,int); //??f??
int i,n,a[100],result[100];
cin>>n;
for(i=1;i<=n;i++)
{
num=1; //?????????????????1
cin>>a[i];
result[i]=f(1,a[i]);
}
for(i=1;i<=n;i++)
{
cout<<result[i]<<endl;
}
}
int f(int x,int y)//f?? ???y???x×???y ?y>x
{
int i;
for(i=2;i<=sqrt(y);i++) //?2???y?? ???????????????????
{
if(y%i==0&&i>=x)//??y??i?? ??i>=x(????x,i,i????? ????????????) ??y?????i?????
{
num++;//????+1
f(i,y/i); //???? ??y???
}
}
return num;
}
|
1 | 439 | int function(int num,int k)
{
int j;
int m=0;
if(num>1)
{for(j=k;j<=num;j++)
{if(num%j==0)
{m=m+function(num/j,j);}
}
return m;
}
else
return 1;
}
int main()
{int i,j;
int n;
cin>>n;
int num[100];
for(i=0;i<n;i++)
{cin>>num[i];}
for(i=0;i<n;i++)
{cout<<function(num[i],2)<<endl;
}
return 0;
} |
1 | 440 | /*
* ???? .cpp
*
* Created on: 2012-11-27
* Author:??
* ???????a?????????????????a = a1 * a2 * a3 * ... * an?
* ??1 < a1 <= a2 <= a3 <= ... <= an?????????????????a = a???????
*/
int answer = 0;//???????
void f(int n, int N) {
if (n < N)
N = n;//????????????
if (N == 1) {
answer++;//??????
return;
}
while (N > 1) {
if (n % N == 0)
f(n / N, N);//?????,?????
N--;//??????
}
}
int main()
{
int n , a ;
cin >> n ; //????n
for ( int i = 0 ; i < n ; i++ )
{
cin >> a ;
f( a , a ) ; //????
cout << answer << endl ;
answer = 0 ; //????
}
return 0 ;
}
|
1 | 441 | /* ????.cpp
* Created on: 2012-11-21
* Author: ??
*/
int ans(int a, int i) {//??????
int sum = 0;//??
for (int j = i; j <= sqrt(a); j++) {//?i???a??
if (a % j != 0)
continue;//??????
sum++;//??????1
if (a >= j * j)
sum += ans(a / j, j);//????????????????????
}
return sum;
}
int main() {
int n, a;//???????
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a;
cout << ans(a, 2) + 1 << endl;
}
return 0;
}
|
1 | 442 |
int sort(int, int, int);
int main()
{
int t=0;
cin>>t;
int k=1;
for (k=1;k<=t;k++)
{
int vacancy=0;
int num=1;
cin>>num;
int i=1;
int temp=num;
for (i=2;i<=temp;i++)
{
while (temp%i==0)
{
vacancy=vacancy+1;
temp=temp/i;
}
}
cout<<sort(1,vacancy,num)<<endl;
}
return 0;
}
int sort(int start, int vacancy, int num)
{
if (num<start)
return 0;
if (vacancy==1)
return 1;
int sum=0;
int i=1;
for (i=start;i<=num;i++)
{
if (num%i==0)
{
sum=sum+sort(i,vacancy-1,num/i);
}
}
return sum;
} |
1 | 443 | int ys(int af,int bf)
{
int s;
if(af<bf)
s=0;
if(af==bf)
s=1;
if(af>bf)
{
s=1;
for(int i=af/2;i>=bf;i--)
{
if(af%i == 0)
{
s+=ys(af/i,i);
}
}
}
return s;
}
int main()
{
int n;
cin >> n;
int p;
while(cin>>p)
{
cout << ys(p,2) << endl;
}
return 0;
}
|
1 | 444 | /*??
???????a????????????????
?a = a1 * a2 * a3 * ... * an???1 < a1 <= a2 <= a3 <= ... <= an?
????????????????a = a???????
????
?1?????????n?????n???????????1?????????a (1 < a < 32768)
????
n???????????????????????????????????*/
int main()
{
int F( int, int );
int N;cin>>N;
for( int I=1; I<=N; ++I)
{
int A; cin>>A;
cout<<F(A,2)<<endl;
}
return 0;
}
int F(int A, int CHU)//?A???CHU???????????
{
int RET=1;
for( int I=CHU;I<=sqrt(A);I++)
{
if(A%I==0)RET+=F(A/I,I);
}
return RET;
}
|
1 | 445 | int f(int t,int k)
{
int u=1,i;
if(t>2)
{
for(i=k;i<=sqrt(t);i++)
{
if(t%i==0)
{
u += f(t/i,i);
}
}
return u;
}
else if(t==2)
return 1;
else if(t==1)
return 0;
}
main()
{
int i,n,t;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&t);
printf("%d\n",f(t,2));
}
}
|
1 | 446 | int main()
{
int f(int a,int min);
int n,a[150],i,b;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
b=f(a[i],2);
printf("%d\n",b);
}
return 0;
}
int f(int a,int min)
{
int result=1,i;
if(a < min)
{
return 0;
}
for(i = min;i<a;i++)
{
if(a % i == 0)
{
result += f(a/i,i);
}
}
return result;
} |
1 | 447 | //1000012915???
int f(int a,int min);
int main()
{
int n,i,a,A[100]; //????
cin>>n;
for(i = 0;i < n;i++) //??
{
cin>>a;
A[i]=f(a,2); //?2?????
};
for(i = 0;i < n;i++)cout<<A[i]<<endl; //??
return 0;
}
int f(int a,int min)
{
int result = 1;
int i;
if(a < min) //?min?a?????????a????????
{
return 0;
}
for(i = min;i<a;i++) //???????????????n???
{
if(a % i == 0)
{
result += f(a/i,i); //????????????????????????x???
}
}
return result;
} |
1 | 448 | int temp=2,sum=0;
void dg(int x)
{
for(int i=temp; i<=x; i++)
{
if(x%i==0)
{
temp=i;
if(x/i==1)
{
sum++;
temp=2;
}
else dg(x/i);
}
}
}
int main()
{
int n;
cin>>n;
int x;
for(int i=0;i<n;i++)
{
cin>>x;
dg(x);
cout<<sum<<endl;
sum=0;
}
return 0;
} |
1 | 449 | int digui(int x,int min);
int main()
{
int n,i,m,y;
scanf("%d",&n);
for(i=0;i<=n-1;i++)
{
scanf("%d",&m);
y=digui(m,2);
printf("%d\n",y);
}
return 0;
}
int digui(int x,int min)
{
int i,result;
result=1;
if(x<min)
{
return 0;
}
for(i=min;i<=x-1;i++)
{
if(x%i==0)
{
result=result+digui(x/i,i);
}
}
return result;
}
|
1 | 450 | void main()
{
int PrimeElement(int n,int m);
int n,m,i,k,t;
m=2;
scanf("%d",&k);
for(i=0;i<k;i++)
{
scanf("%d",&n);
t=PrimeElement(n,m);
printf("%d\n",t);
}
}
int PrimeElement(int n,int m)
{
int i,t;
t=0;
for (i=m;i <=sqrt((double)(n));i++)
{
if (n % i == 0)
t = t + PrimeElement(n / i, i);
}
t = t + 1;
return t;
} |
1 | 451 | int fuck(int n,int m)
{
int i,cnt=1;
if(m>=sqrt(n))
{return 1;}
for(i=m;i<=sqrt(n);i++)
{
if(n%i==0)
{
cnt+=fuck(n/i,i);
}
}
return cnt;
}
int main()
{
int t, n, k;
cin>>t;
for(k=1;k<=t;k++)
{
cin>>n;
cout<<fuck(n,2)<<endl;
}
int x;cin>>x;
return 0;
}
|
1 | 452 | int count;
void f(int a ,int b)
{
int j;
if(a==1)
count+=1;
else
{
for(j=b;j<=a;j++)
{
if(a%j==0)
f(a/j,j);
}
}
}
int main()
{
int n,i,number;
scanf("%d",&n);
for(i=0;i<n;i++)
{
count=0;
scanf("%d",&number);
f(number,2);
printf("%d\n",count);
}
return 0;
} |
1 | 453 | int main()
{
int count(int x,int y);
int i,j,n,a[100],b[100];
scanf("%d", &n);
for(i=1;i<=n;i++){scanf("%d", &a[i]);}
for(i=1;i<=n;i++){
b[i]=0;
for(j=2;j<=a[i];j++){
b[i]+=count(a[i],j);
}
}
for(i=1;i<=n;i++){printf("%d\n", b[i]);}
return 0;
}
int count(int x,int y)
{
int c=0,k;
if(x==y){c=1;}
if(x%y!=0){c=0;}
if(x!=y&&x%y==0){
for(k=y;k>=2;k--){c+=count((x/y),k);}
}
return(c);
}
|
1 | 454 |
int sum(int a,int i)
{
int ret=1;
for(;i<=sqrt((float)a);i++)
{
if(a%i==0)
{
ret+=sum(a/i,i);
}
}
return ret;
}
int main()
{
int t,a,j;
cin>>t;
for(j=0;j<t;j++)
{
cin>>a;
cout<<sum(a,2)<<endl;
}
return 0;
} |
1 | 455 | int f(int,int);
int main()
{
int n,i,a,b[100];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a);
b[i]=f(a,2);
}
for(i=0;i<n;i++)
{
printf("%d\n",b[i]);
}
return 0;
}
int f(int x,int y)
{
int j,sum=1;
if(x<y)
sum=0;
else
{
for(j=y;j<x;j++)
{
if(x%j==0)
sum=sum+f(x/j,j);
}
}
return sum;
}
|
1 | 456 | int t;//t???
void f(int n,int d)//n?????d???
{
int i;
if(n==1)//
t++;
else
{
for(i=d;i<=n;i++)
{
if(n%i==0)
{
f(n/i,i);
}
}
}
}
int main()
{
int number[100];
int n,i;
int result[100];
cin>>n;
for(i=0;i<n;i++)
{
cin>>number[i];
}
for(i=0;i<n;i++)
{
t=0;
f(number[i],2);
result[i]=t;
}
for(i=0;i<n;i++)
{
cout<<result[i]<<endl;
}
return 0;
}
|
1 | 457 | int p=0,q=2;
int jizu(int x)
{
for(int i=q;i<=x-1;i++)
{
if((x%i==0)&&(x/i>i))
{
p++;
q=i;
jizu(x/i);
}
else if((x%i==0)&&(x/i==i))
{
p++;
}
}
return p;
}
int main()
{
int n;
scanf("%d",&n);
int a[100];
for(int i=0;i<=n-1;i++)
{
scanf("%d",&a[i]);
}
for(int i=0;i<=n-1;i++)
{
printf("%d\n",jizu(a[i])+1);
p=0,q=2;
}
int y;
scanf("%d",&y);
}
|
1 | 458 |
int fen(int x,int y);
int main(){
int n,i,m[500];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&m[i]);
printf("%d\n",fen(m[i],2));
}
return 0;
}
int fen(int x,int y){
int j,k;
int result=1;
if(x<y)
return 0;
for(j=y;j<x;j++)
{
if(x%j==0)
result+=fen(x/j,j);
}
return result;
} |
1 | 459 | int f(int a,int b);
int main()
{
int n,a,i;
cin>>n;
for(i=0;i<n;i++)
{
cin>>a;
cout<<f(a,2)<<endl;
}
return 0;
}
int f(int x,int y) //y?????
{
int j,k,t=0,m=0;
for(j=2;j<x;j++)
if(x%j==0) t++;
if(t==0) return 1; //?????,??1
else
{
for(k=y;k<=(int)sqrt((double)x);k++)
if(x%k==0) m=m+f(x/k,k);
return (m+1);
}
}
|
1 | 460 | int im(int n,int max)
{
int s=0,i;
if(n==1)
return 1;
for(i=max;i>1;i--)
if(n%i==0)
s+=im(n/i,i);
return s;
}
int main()
{
int i,n,t;
scanf("%d%d",&n,&t);
printf("%d",im(t,t));
for(i=1;i<n;i++)
{
scanf("%d",&t);
printf("\n%d",im(t,t));
}
//getch();
return 0;
}
|
1 | 461 | void decprime(int begain,int a);
int sum=1;
int main()
{
int n,a;
int k;cin>>n;
for(k=0;k<n;k++){
cin>>a;
decprime(2,a) ;
cout<<sum<<endl;
sum=1;
}
return 0;
}
void decprime(int begain,int a)
{
int i;
//int u=int(sqrt(double(a)));
//int m[10000]={};
//if(a==2||a==3||a==5)return 1;
//else{
for(i=begain;i<=a;i++){
if(a%i==0&&i<=a/i)
{
sum++;
decprime(i,a/i);
}
if(i>a/i)break;
//m[i]=decprime(a/i);
//else m[i]=0;
//sum+=m[i];
//}
//return sum+1;
}
}
|
1 | 462 | /*
* 1.cpp
*
* Created on: 2010-12-1
* Author: ???
* ??? ????
*/
int g(int x,int j){
for(j++;j<=x;j++){
if(x==j)
return 1;
if(x%j==0&&x/j>=j)
return g(x/j,j-1)+g(x,j);
}
return 0;
}
int main(){
int n,a;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a;
cout<<g(a,1)<<endl;
}
return 0;
} |
1 | 463 | /*
* ????1118-4.cpp
* ?????
* ????: 2011-11-29
* ??????????a?????????????????a = a1 * a2 * a3 * ... * an???1 < a1 <= a2 <= a3 <= ... <= an?????????????
*/
int divide(int n,int a)//n?????????a????????????????????
{
int s=0,i;
if(n==1) return 1;//n?1???
for(i=a;i>1;i--)
if(n%i==0)
s+=divide(n/i,i);//???????
return s;//??0??????????0??????????
}
int main()
{
int n,k;
cin>>k;//??????
while(k>0)//???????
{
cin>>n;//????????
cout<<divide(n,n)<<endl;//??????
k--;//?????????
}
return 0;//????
}
|
1 | 464 |
void fenjie( int i , int a ) ;
int k = 1 ;
int main()
{
int n , m , a ;
cin >> n ;
for( m = 1 ; m <= n ; m ++ )
{
cin >> a ;
fenjie( 2 , a ) ;
cout << k << endl ;
k = 1 ;
}
return 0 ;
}
void fenjie( int i , int a )
{
for( ; i <= sqrt( a ) ; i ++ )
if( a % i == 0 )
{
k ++ ;
fenjie( i , a / i ) ;
}
}
|
1 | 465 | int d;
int fen(int i,int a)
{
if(i>a)
{
return 0;
}
int result=1;
int j;
for(j=i;j<a;j++)
{
if(a%j==0)
{
result=result+fen(j,a/j);
}
}
return result;
}
int main()
{
int n;
cin >> n;
int k=0;
while(k<n)
{
int a;
cin >> a;
int i=2;
d=fen(i,a);
cout << d << endl;
k++;
}
return 0;
cin.get();cin.get();cin.get();
}
|
1 | 466 | int cal; //??cal
int fac(int a,int x){ //a???????
if(x==1) { cal++; return 1; } //??x?i?? ????????????1
for(int i=2;i<=x;i++)
if(x%i==0&&i>=a) //??? ??????????
fac(i,x/i);}
int main(){
int n,b;
cin>>n;
while(n>0){
cal=0;
cin>>b;
fac(1,b);
cout<<cal<<endl;
n--;
}} |
1 | 467 | /**
* author:liucheng
* date:2010-10-23 13:04:16
* file:factors.cpp
*/
int factor(int num,int minA1)
{
int count=0;
int sqrtNum;
int i;
if(num <= minA1)
return 0;
sqrtNum=(int)sqrt((double)num);
for(i=minA1;i<=sqrtNum;i++)
if(num % i == 0)
{
count++;//num=i*(num/i)
count+=factor(num/i,i);//num=i*(factor(num/i))
}
return count;
}
int main()
{
int n;
int num;
cin>>n;
while(n -- )
{
cin>>num;
cout<<factor(num,2)+1<<endl;
}
return 0;
} |
1 | 468 | int f(int m,int j);
int main()
{
int n,m;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>m;
cout<<f(m,2)<<endl;
}
return 0;
}
int f(int m,int j) //
{
int num=1;
for(int i=j;i<=sqrt(m);i++)
{
if(m%i==0)
{
num+=f(m/i,i);
}
}
return num;
}
|
1 | 469 | int division(int m,int k)
{
int num=0;
if(m>=k)
{
for(int i=k;i<=m;i++)
{
if(m==i) num++;
else if(m%i==0)
{
num+=division(m/i,i);
}
}
}
return num;
}
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++)
{
int a;
cin>>a;
cout<<division(a,2)<<endl;
}
return 0;
}
|
1 | 470 |
int function(int n,int a)
{
int kind=0;
int i;
if(n==1)
return 1;
for(i=a;i<=n;i++)
{
if(n%i==0)
{
if(n/i<i&&i!=n);
else
{
kind=kind+function(n/i,i);
}
}
}
return kind;
}
int main()
{
int m,n,i,sum;
cin>>m;
for(i=1;i<=m;i++)
{
cin>>n;
sum=function(n,2);
cout<<sum<<endl;
}
return 0;
} |
1 | 471 |
int num;
int dg(int m,int limit);
int main()
{
int n;
cin>>n;
for (int i=1;i<=n;i++)
{
int m; cin>>m;
num=0;
dg(m,2);
cout<<num<<endl;
}
return 0;
}
int dg(int m,int limit)
{
for (int i=limit;i<=m/2;i++)
if (m%i==0) dg(m/i,i);
if (m>=limit) num++;
return 0;
}
|
1 | 472 |
int sum=0;//?????????????
void count(int N,int i)
{
if(N==1) sum++;//??N??????i?????N???1????????????????sum??1
while(i<=N){
if(N%i==0) count(N/i,i);
i++;//N??????????????i?
}
return ;
}
int main()
{
int T=0;//??????
cin >> T;
while(T--)
{
int N=0;//?????
cin >> N;
int i=2,total=1;//???????2???a=a????????total?????1
while(i<=N/2)
{
if(N%i==0)
{
sum = 0;
count(N/i,i);
total+=sum;
}//??N??????????????????????
i++;
}
cout<<total<<endl;
}
return 0;
}
|
1 | 473 | //*************************************************************************
//*????????? *****************************************************
//*??????? 1200012979 **********************************************
//*???2012.11.27 *******************************************************
//*************************************************************************
void breakup(int, int);
int sum;
int main ()
{
int n, x, count=0;
cin >> n ; //??????
while( count < n )
{
sum = 0 ;
count++ ; //?????
cin >> x ; //??????
if(x > 3)
breakup(x, 2); //????
cout << sum+1 << endl; //???????????
}
return 0;
}
void breakup( int x, int j )
{
int i, p, m;
m = x; //???????
p = sqrt( (double)x ) ; //p??????????
for( i = j ; i <= p ; i++ )
if (m % i == 0 ) //????????????????
{
sum++ ; //??????
x = m / i ;
breakup(x, i) ;
}
return ;
} |
1 | 474 | /*
* ????.cpp
*
* Created on: 2012-11-30
* Author: ??
*/
int f(int min,int a) //????????????????min???????a????
{
if(min>a) return 0; //???????a???????????????0
int i;int num=1; //??????i????num???a=a????????1
for(i=min;i<=sqrt(a);i++)//i?min?????????????????
{
if(a%i==0) //??a?i??
{
num = num + f(i,a/i);//????a/i?min?i??????
}
}
return num; //????num
}
int main() //?????
{
int m,a,j; //m????????a???????j????
cin>>m; //??m
for(j=0;j<m;j++) //?m??
{
cin>>a; //???????
cout<<f(2,a)<<endl; //???????
}
return 0; //???????????
}
|
1 | 475 | /*int hf[32768][32768]={0};
int work(int m,int n)
{
if(hf[m][n]!=0)
return hf[m][n];
if(m%n!=0)
{
hf[m][n]=0;
return 0;
}
for(int i=n;i<=m/n;i++)
hf[m][n]+=work(m/n,i);
return hf[m][n];
}*/
int work(int m,int n)
{
if(m==n)
return 1;
if(m%n!=0)
return 0;
int sum=0;
for(int i=n;i<=m/n;i++)
sum+=work(m/n,i);
return sum;
}
int main()
{
int n,m,a;
cin>>n;
int i,j,k;
for(i=1;i<=n;i++)
{
cin>>m;
int s=0;
for(j=2;j<=m;j++)
s+=work(m,j);
cout<<s<<endl;
}
return 0;
}
|
1 | 476 | int tru(int c)
{
int j,p=0;
if(c==1||c==2)
return 1;
else for(j=2;j<=pow((double)c,0.5);j++)
if(c%j==0)
{
p=1;
break;
}
if(p==1) return 0;
else return 1;
}
int count(int a,int b)
{
int i,k=1;
if(!tru(a))
for(i=b;i<=pow((double)a,0.5);i++)
if(a%i==0)
k=k+count(a/i,i);
return k;
}
int main()
{
int n,x[999],q;
scanf("%d",&n);
for(q=0;q<n;q++)
scanf("%d",&x[q]);
for(q=0;q<n;q++)
printf("%d\n",count(x[q],2));
return 0;
}
|
1 | 477 | int x[1000]={0};
void f(int m,int n,int l)
{
int i;
for(i=m;i<=n;i++)
{
if(n%i!=0) continue;
else
{
if(n/i==1)
{
x[l]++;
return;
}
else f(i,n/i,l);
}
}
}
int main()
{
int a[1000],s,j,sum;
cin>>sum;
for(j=1;j<=sum;j++)
{
cin>>a[j];
s=2;
f(s,a[j],j);
}
for(j=1;j<=sum;j++)
{
cout<<x[j]<<endl;
}
return 0;
} |
1 | 478 | int numcount=0;
void divide(int num,int x)
{
int i;
if(num==1)
numcount++;
for(i=x;i<=num;i++)
{
if(num%i==0)
divide(num/i,i);
}
}
int main()
{
int n,num,i;
int first=2;
int ans[100];
cin>>n;
for(i=1;i<=n;i++)
{
cin>>num;
divide(num,first);
ans[i]=numcount;
//cout<<count<<endl;
numcount=0;
}
for(i=1;i<=n;i++)
cout<<ans[i]<<endl;
return 0;
}
|
1 | 479 | /************************/
/* ???? */
/* ??? pyyaoer */
/* ?? 2011.11.26 */
/************************/
void yinshu(int);
int sum=1,j=2;
int main()
{
int n,m;
int i;
cin>>n;
for (i=1;i<=n;i++) //?i????
{
cin>>m;
yinshu(m); //????
cout<<sum<<endl;
sum=1,j=2;
}
return 0;
}
void yinshu(int mm) //?????
{
int k;
for (k=j;k*k<=mm;k++) //????
{
if (mm%k==0)
{
sum=sum+1;
j=k;
yinshu(mm/k); //???????
}
}
} |
1 | 480 | int l=0,num=0,o;
void f(int i,int in)
{
int j;
for(j=i;j<(in+1);j++)
{
if(j*(in/j)==in)
{
// out[l]=j;
// l=l+1;
o=in/j;
/*cout<<j<<endl;
cout<<"----------------------"<<endl;*/
f(j,in/j);
o=o*j;
}
//else f(j+1,in);
}
if(o==1) {num=num+1;/*cout<<"**************************"<<endl;*/}
}
int main()
{
int t;
cin>>t;
int i;
int in;
for(i=0;i<t;i++)
{
cin>>in;
f(2,in);
cout<<num<<endl;
num=0;
}
return 0;
}
|
1 | 481 | int shuliang(int m,int n);
main()
{
int n;
scanf("%d",&n);
for (int i = 1;i <= n;i ++)
{
int x,q,answer=1;
scanf("%d",&x);
q=sqrt(x)+1;
for (int j = 2; j < q; j ++)
{
if (x%j==0)
answer+=shuliang(j,x/j);
}
printf("%d\n\n",answer);
}
}
int shuliang(int m,int n)
{
int q,answer=0,y=0;
q=sqrt(n)+1;
for (int j = m;j < q;j ++)
{
if (n%j==0)
answer+=shuliang(j,n/j),y=1;
}
if(y==1)
return answer+1;
else
return 1;
} |
1 | 482 | ////////////////////////
//??????? //
//?????? //
//???1200012823 //
//???2012?11?25?//
//???????? //
////////////////////////
int totalCount; // ?????????
void FindFact(int x, int max) // ??????max?????????????
{
if (x == 1) // ??????
{
totalCount++;
return;
}
for (int i = max; i > 1; i--) // ?max????????
if (x % i == 0) // ????
FindFact(x / i, i); // ?????????
return;
}
int main()
{
int n, x;
for (cin >> n; n > 0; n--) // ?????????
{
totalCount = 0;
cin >> x;
FindFact(x, x / 2); // ?x/2?????????
cout << totalCount + 1 << endl; // ?????
}
return 0;
} |
1 | 483 | void main()
{
int fac(int a,int b);
int n,i,m,a[100];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
{
m=fac(a[i],2);
printf("%d\n",m);
}
}
int fac(int a,int b)
{
int j,i;
if(a<b) j=0;
else
{
j=1;
for(i=b;i<a;i++)
{
if(a%i==0) j=j+fac(a/i,i);
}
}
return(j);
}
|
1 | 484 | 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 | 485 | int num(int b,int min);
int x=1,m;
int main()
{
int a,n,b;
scanf("%d",&n);
for(a=0;a<=n-1;a++)
{
scanf("%d",&b);
m=b;
b=num(b,2);
printf("%d\n",b);
x=1;
}
return 0;
}
int num(int b,int min)
{
int a,c;
for(a=min;a<b;a++)
{
if((b%a==0)&&(b/a>=a))
{
if(num(b/a,a)==1)
{
x++;
}
}
if(a==m-1) return x;
}
return 1;
} |
1 | 486 | int yinshu[10000];
int j=0;
int temp=0;
int main()
{
void fenjie(int j,int sum);
int t,n[10000],i;
cin>>t;
for(i=0;i<10000;i++)
{
yinshu[i]=0;
}
for(i=0;i<t;i++)
{
cin>>n[i];
}
for(i=0;i<t;i++)
{
fenjie(1,n[i]);
cout<<temp<<endl;
temp=0;
}
return 0;
}
void fenjie(int j,int sum)
{
for(int i=2;i<=sum;i++)
{
if(sum%i==0&&yinshu[j-1]<=i)
{
yinshu[j]=i;
if(sum==i)
{
temp++;
}
else
{
fenjie(j+1,sum/i);
}
}
}
}
|
1 | 487 | int sum = 0;
void f(int a,int s)
{
int i;
if(a == 1)
sum++;
else
{
for(i = s; i <= a; i++)
{
if(a % i == 0)
f((a / i),i);
}
}
return;
}
int main()
{
int n, num, j;
cin >> n;
for (j = 1; j <= n; j++)
{
cin >> num;
f(num,2);
printf("%d\n",sum);
sum = 0;
}
return 0;
}
|
1 | 488 |
// ????.cpp : ??????????????
//
int f(int x,int y)
{
int i,a=1;
if(x<y) return 0;
if(x==y) return 1;
if(x>y)
{
if(y==1)
{
for(i=y+1;i<=x;i++)
{
if(x%i==0) a=a+f(x/i,i);
}
}
else
{
for(i=y;i<=x;i++)
{
if(x%i==0) a=a+f(x/i,i);
}
}
return a;
}
}
int main()
{
int n,j,b=0,p,k;
scanf("%d",&p);
for(k=1;k<=p;++k)
{
scanf("%d",&n);
b=f(n,1);
printf("%d\n",b);
}
return 0;
}
|
1 | 489 | int f(int x,int y);// ??????x????????y?????????????????
int main()
{
int n,i,j,a,sum;
cin>>n;
for(i=1;i<=n;i++)//??
{
cin>>a;
sum=0; //???
for(j=1;j<=a;j++)
sum+=f(a,j); //??
cout<<sum<<endl; //??
}
return 0;
}
int f(int x,int y)//???
{
int i,num=0;
if(y==1)
return 0;
else
{
if(x%y!=0)
return 0;
else if(x==y)
return 1;
else
{
for(i=y;i>=1;i--)
num+=f(x/y,i); //??
return num;
}
}
}
/*
????????????
?100??
sum=????
f(100,100)=1 ??100=100
f(100,99) =0
f(100,98)=0
....
....
f(100,50)=f(2,50)+f(2,49)+........+f(2,2)+f(2,1) =1 ?????50????f(2,2)?1,??????
....
....
f(100,2) = f(50,2)+f(50,1)=f(25,2)+0=0
f(100,1) =0
????? ??????????????
*/ |
1 | 490 | int ys(int x,int min){
int r=1;
if(x<min)
return 0;
for(int i=min;i<x;i++){
if(x%i==0)
r+=ys(x/i,i);
}
return r;
}
int main(){
int n,a[1000];
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(int i=0;i<n;i++){
printf("%d\n",ys(a[i],2));
}
return 0;
}
|
1 | 491 | int cal(int,int);
int main ()
{
//????
int n=0;
cin>>n;
//??????
for (int i=0;i<n;i++)
{
int m=0;
cin>>m;
//?2??????????????
cout<<cal(m,2)<<endl;
}
return 0;
}
//???????1??????????2?????????
int cal (int m,int i)
{
int count=0;
if (m==1) return 1;//???1?????????1???
for (i;i<=m;i++)//??i?????????????
{
if (m%i==0)
{
count+=cal(m/i,i);
}
}
//?????
return count;
}
|
1 | 492 | int t=0,ways; //??????t?ways
void divide(int x,int h)
{
int i;
if(x==1) //??x==1
{t++;ways=t;} //t+1?ways?????t
else
for(i=h;i<=x;i++)
if(x%i==0)
{h=i;
divide(x/h,h); //h?????????????divide?????????
}
}
int main()
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{cin>>a[i];
t=0;divide(a[i],2);
cout<<ways<<endl;}
return 0;
} |
1 | 493 | int sum=0;
int main()
{
void yinshu(int,int);//????????????????????????
int i,n,a;
cin>>n;
for(i=1;i<=n;i++)
{
sum=0;
cin>>a;
yinshu(a,2);
cout<<sum<<endl;
}
return 0;
}
void yinshu(int a,int x)
{
if(a!=1)
{
for(int i=x;i<=a;i++)//?x?????
if(a%i==0)//????
yinshu(a/i,i);//?a/i??????????????i???
}
if(a==1)//????????????
sum++;
} |
1 | 494 | int fenjie(int n,int min)
{int i,a=0,x=0;
for(i=2;i<=n;i++)
if(n%i==0)
a=a+1;
if(n==1)
return 1;
else
{
for(i=min;i<=n;i++)
{
if(n%i==0)
x=x+fenjie(n/i,i);
}
return x;
}
}
main()
{
int t,j,num;
scanf("%d",&t);
for(j=1;j<=t;j++)
{
scanf("%d",&num);
printf("%d\n",fenjie(num,2));}
} |
1 | 495 |
int num = 1, i, factor;
void f(int factor, int x)
{
for (; factor * factor <= x; factor++)
{
if (x % factor == 0)
{
num++;
f(factor, x / factor);
}
}
}
int main()
{
int a, n;
cin >> n;
while(n--)
{
cin >> a;
f(2, a);
cout << num << endl;
num = 1;
}
return 0;
}
|
1 | 496 | int varieties=0,p;
int dfs(int dep,int last,int k) //???????????k????? ??
{
if (k == 1) //??k=1
{
varieties++; //???+1
return 0;
}
for (int i = last; i <= k; i++)
if (k % i == 0) //??k??i????????????k=1
{
dfs(dep+1,i,k/i);
}
}
int main()
{
int i,n,t;
cin>>n; //??????
int m[n]; //????n????????
for(i=0;i<n;i++)
{
cin>>t;
dfs(0,2,t);
m[i]=varieties;
varieties=0;
}
for(i=0;i<n;i++)
cout<<m[i]<<endl; //???????????
return 0;
} |
1 | 497 | /*
* part.cpp
*
* Created on: 2012-11-25
* Author: Lsj
*/
int disintegerate(int a, int b)//?????a????
{
if (a == b || b == 1)//a b????b=1??????
return 1;
if (a > b)//a??b?b???1????0???0
return 0;
int ans = 0;//ans???
for (int i = a; i <= b; i++)//?a?b??
{
if (b % i == 0)//b??????
ans = ans + disintegerate(i, b / i);//??????
}
return ans;//??ans
}
int main()//main??
{
int Time;
cin >> Time;//????
while (Time > 0) {
int n;
cin >> n;//??n
cout << disintegerate(2, n) << endl;//????
Time--;//Time?1
}
return 0;
}//??
|
1 | 498 | int Fz(int,int);
int main()
{
int n,num[1000];
cin>>n;
for(int i=0;i<n;i++)
{
int a;
cin>>a;
num[i]=Fz(a,2);
}
for(int i=0;i<n;i++){
cout<<num[i]<<endl;
}
return 0;
}
int Fz(int x,int m)
{
int s=1,i;
int y=(int)sqrt((double)x);
for(i=m;i<=y;i++)
{
if(x%i==0)
{
s=s+Fz(x/i,i);
}
}
return s;
}
|
1 | 499 | int main(){
int number(int n, int low);
int n, i, data, ans;
scanf("%d", &n);
for (i=1; i<=n; i++)
{
scanf("%d", &data);
ans = number(data, 2);
printf("%d\n", ans);
}
}
int number(int n, int low)
{
int j, ans;
ans = 0;
for (j = low ; j * j<= n; j++)
{
if (n % j == 0)
ans = ans + number(n / j, j);
}
ans = ans + 1;
return ans;
} |