label
stringlengths 1
2
| index
stringlengths 1
5
| code
stringlengths 87
8.24k
|
---|---|---|
1 | 200 | int fact(int n,int m);//????fact
int main()//?????
{
int n,a[35000],i,b[35000];
cin>>n;
for(i=0;i<n;i++)cin>>a[i];//???????????
for(i=0;i<n;i++)b[i]=fact(a[i],2);//?????????????????fact(a[i],2)
for(i=0;i<n;i++)cout<<b[i]<<endl;//????????
return 0;
}//?????
int fact(int n,int m)//fact??
{
int sum=1,i,temp=0;
if(n<m)return 0;//?n<m,?????0
else if(n==2)return 1;//?n???2??????1
else
{
for(i=m;i<n;i++)//??????m?n
{if(n%i==0)sum=sum+fact(n/i,i);}//?n??i????sum??fact(n/i,i)??,????
return sum;
}
}//fact?? |
1 | 201 | int sep(int a, int b)
{
int i;
int ans = 0;
if (a == 1)
ans = 1;
for (i = b; i <= a; i++)
{
if (a%i == 0)
{
ans += sep(a / i, i);
}
}
return ans;
}
int baka(int a)
{
int cirno;
cirno = sep(a, 2);
return cirno;
}
int main()
{
int n, pre;
int i,j;
int ans;
scanf("%d", &n);
for (i = 1; i <= n; i++)
{
scanf("%d", &pre);
ans = baka(pre);
printf("%d\n", ans);
}
} |
1 | 202 | /*
* hehe.cpp
*
* Created on: 2012-11-25
* Author:??
* ???????a?????????????????a = a1 * a2 * a3 * ... * an?
* ??1 < a1 <= a2 <= a3 <= ... <= an?????????????????a = a???????
*/
int sum = 1;//??????Sum
int Fact(int x, int y);
int main() {
int n, a;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a;
sum = 1;//????sum
Fact(a, 2);//????
cout << sum << endl;
}
return 0;
}
int Fact(int x, int y) {
if (x == 1)
return 0;//???1???0
else {
for (; y <= sqrt(x); y++)//????????
if (x % y == 0) {
sum = sum + Fact(x / y, y); //????????Fact(??y)
}
return 1;
}
}
|
1 | 203 | int f(int m,int k);
int main()
{
int n,i,k,m;//????n,????m,???k
cin>>n;
for(i=1;i<=n;i++)
{
cin>>m;
k=2;
cout<<f(m,k)<<endl;
}
return 0;
}
int f(int m,int k)
{
int m1,sum=1;
m1=m;
while(k<=(int)sqrt(m))
{
if(m%k==0)
{
m=m/k;
sum=sum +f(m,k);
}
m=m1;
k++;
}
return sum;
}
|
1 | 204 | int fen(int a,int k)
{
int s=0,j,t=0;
if(a==1&&a>=k)
{
s=1;
}
else if(a==k)
{s=1;}
else
{
for(j=2;j<=a;j++)
{
if(a%j==0&&j>=k)
s=s+fen(a/j,j);
t=1;
}
if(t==0)
s++;
}
return s;
}
int main()
{
int n,i,q,a;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>a;
cout<<fen(a,1)<<endl;
}
cin>>q;
return 0;
} |
1 | 205 | int n, m, ans, a[20];
void calc(int dep, int x)
{
if (x == 1)
{
ans++;
return;
}
for (int i = a[dep-1]; i <= x; i++)
if (!(x % i))
{
a[dep] = i;
calc(dep + 1, x / i);
}
}
int main()
{
scanf("%d", &n);
for (a[0] = 2;n; n--)
{
scanf("%d", &m);
ans = 0;
calc(1, m);
printf("%d\n", ans);
}
return 0;
} |
1 | 206 | int num,t,yin[50];
void dd(int n, int a,int d ,int m)
{
int i;
if(d==m)
{
t++;
return;
}
for(i=a;i<num;i++)
{
if(n/yin[i]>=yin[i]&&n%yin[i]==0)
dd(n/yin[i],i,d+1,m);
}
}
void q_ys(int n)
{
int i;
for(i=2;i<=n;i++)
if(n%i==0)
{
num++;
yin[num]=i;
}
return ;
}
int m_ys(int n)
{
int i;
for(i=2;i<=sqrt(n);i++)
{
if(n % i==0 )
{
return i;
}
}
return 1;
}
void output(int y)
{
int k=1,i,x;
x=y;
t=1,num=0,memset(yin,0,sizeof(yin));
q_ys(x);
while(m_ys(x)!=1)
{
k++;
x=x/m_ys(x);
}
for(i=2;i<=k;i++)
dd(y,1,1,i);
cout<<t<<endl;
}
int main()
{
int n,i,a[1000];
t=0,num=0;
cin>>n;
for(i=1;i<=n;i++)
cin>>a[i];
for(i=1;i<=n;i++)
output(a[i]);
return 0;
} |
1 | 207 |
int fac(int p, int q)
{
int i, t = 1;
if (p > q)
{
return 0;
}
if (p == q)
{
return 1;
}
for (i = p; i <= sqrt(q); i++)
{
if (q % i == 0)
{
t += fac(i, q / i);
}
}
return t;
}
int main()
{
int a, i, n;
cin >> n;
for (i = 0; i < n; i++)
{
cin >> a;
cout << fac(2, a) << endl;
}
return 0;
} |
1 | 208 | int qq(int m){
int i,j;
j=0;
for(i=2;i*i<=j;i++){
if(m%i==0){
j=1;
break;
}
}
return j;
}
int pp(int m,int j){
int i,k=0;
if(m==1)
return 1;
else {
k++;
for(i=j;i*i<=m;i++){
if(qq(i)==0&&m%i==0){
k=k+pp(m/i,i);
}
}
}
return k;
}
int main(){
int n,i,p;
cin>>n;
int aa[n+1];
for(i=1;i<=n;i++){
cin>>p;
aa[i]=pp(p,2);
}
for(i=1;i<=n;i++)
cout<<aa[i]<<endl;
return 0;
} |
1 | 209 | /*
?? - 1090 ????
??
???????a?????????????????a = a1 * a2 * a3 * ... * an???1 < a1 <= a2 <= a3 <= ... <= an?????????????????
a = a???????
????
?1?????????n?????n???????????1?????????a (1 < a < 32768)
????
n???????????????????????????????????
????
2
2
20
????
1
4
*/
void main()
{
int st(int a,int b); //????st?????????a?=a1?b???????
int j,n,m,sum;
scanf("%d",&n);
for(j=1;j<=n;j++)
{
scanf("%d",&m);
sum=st(2,m);
printf("%d\n",sum);
}
}
int st(int a,int b)
{
int i,c;
c=0;
if(a==0)
c=c+1;
else
{
for(i=a;i<=sqrt(b);i++)
{
if(b%i==0)
c=st(i,(b/i))+c;
}
if(i>sqrt(b))
c=c+1;
}
return c;
} |
1 | 210 | //********************************************************
//* ???:1.cpp *
//* ?????? 1200012948 *
//* ????: 2012 11 25 *
//* ????:???? *
//********************************************************
int b, j;
int a[1000] = {0}; //a??????
void fjys(int);
int main()
{
int n, i, x;
cin >> n;
for (i = 1; i <= n; i++)
{
j = 0;
b = 0;
memset (a, 0, sizeof(a));
cin >> x;
fjys (x);
cout << b << endl;
}
return 0;
}
void fjys(int x)
{
int i, n1;
for (i = 2; i <= x; i++) //?2????
{
if (x % i == 0 && i >= a[j])
{
a[++j] = i;
n1 = x / i;
if(n1 == 1) //????
{
b++; //??
}
else
{
fjys(n1);
}
j--;
}
}
return;
}
|
1 | 211 | int way(int x,int m)
{
int sum=0,p=0,i;
for(i=m;i<x;i++)
if(x%i==0)
{
p++;
sum=sum+way(x/i,i);
}
sum=sum+1;
if(p==0) sum=1;
if(m>x) sum=0;
return(sum);
}
int main()
{
int n,a,i;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a);
printf("%d\n",way(a,2));
}
return 0;
} |
1 | 212 | int devide(int n,int k)
{
int s,i;
s=1;
for(i=k;i<=sqrt(n*1.0);i++)
{
if(n%i==0)
{
s=s+devide(n/i,i);
}
}
return s;
}
int main()
{
int n,a[200],i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(i==0)printf("%d",devide(a[i],2));
else printf("\n%d",devide(a[i],2));
}
return 0;
} |
1 | 213 | int sum=0,t; //sum?????????,t??????
void dg(int s) //?s????
{
for(int i=s;i<=t;i++)
{
if(t%i==0) //?i??t??
{
t=t/i;
if(t==1) sum++; //t????,??+1
else dg(i); //??????
t=t*i;
}
}
}
int main()
{
int n;
cin>>n;
while(n--) //??n?
{
cin>>t;
dg(2);
cout<<sum<<endl;
sum=0;
}
return 0;
} |
1 | 214 | //
// main.cpp
// HomeWork_11.14.Functions
// ????
// Created by ??? on 11/19/12.
// Copyright (c) 2012 airjcy. All rights reserved.
//
//#include <string>
//??n???????????from
int num;
void divide(int n,int from)
{
int i;
for (i = from; i < n; i ++) {
if (n % i == 0) {
if (n / i < i) {
return;
}
num ++;
divide(n / i, i);
}
}
}
// 20 2 10 2 2 5 4 5 5 4
int main(int argc, const char * argv[])
{
int n;
cin >> n;
int i;
int numberToDivide;
for (i = 0; i < n; i++)
{
cin >> numberToDivide;
num = 0;
divide(numberToDivide, 2);
cout << num + 1 << endl;
}
// num =0;
// divide(20, 2);
// cout << num + 1;
}
|
1 | 215 |
int ispr(int t)
{
int v=(int)sqrt(t*1.0)+1;
for(int i=2; i<v; i++)
if(t%i==0)
return 0;
return 1;
}
int sum;
void fun(int n,int i)
{
if(n==1)
sum++;
for (; i<=n; i++)
{
if(n%i==0)
fun(n/i,i);
}
return ;
}
int main() {
int n;
scanf("%d",&n);
for (int j=0; j<n; j++)
{
int a;
scanf("%d",&a);
if(ispr(a)==1)
{
printf("1\n");
continue;
}
int res=1;
for (int i=2; i<=a/2; i++)
{
if(a%i==0)
{
sum=0;
fun(a/i,i);
res=res+sum;
}
}
printf("%d\n",res);
}
return 0;
}
|
1 | 216 | int f(int a,int min);
int main()
{
int n,i,a;
cin>>n;
for(i=0;i<n;i++){
cin>>a;
printf("%d\n",f(a,2));}
return 0;
}
int f(int a,int min)
{
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;
} |
1 | 217 | int fenjie(int x ,int b)
{
int i,z=0,c;
for(i=b;i<=x;i++)
{
if(x==i)
z=z+1;
else if(x%i==0)
{
c=x/i;
z=z+fenjie(c,i);
}
}
return(z);
}
void main()
{
int n,i,num,a;
scanf("%d\n",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a);
num=fenjie(a,2);
printf("%d\n",num);
}
}
|
1 | 218 | int f(int,int);
int main()
{
int n,a[32768],i;
cin>>n;
for(i=0;i<=n-1;i++)
{
cin>>a[i];
}
for(i=0;i<=n-1;i++)
{
cout<<f(a[i],2)+1<<endl;
}
return 0;
}
int f(int a,int p)
{
int i,sum=0;
for(i=2;i<=sqrt(a);i++)
{
if(((double)a/i==a/i)&&(i>=p))
{ p=i;
sum=sum+1+f(a/i,p);
}
}
return sum;
}
|
1 | 219 |
int fenjie(int num,int min);
int k=2;
int main(){
int n,i,jieguo,num;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d",&num);
jieguo=fenjie(num,2);
printf("%d\n",jieguo);
}
return 0;
}
int fenjie(int num,int min){
int j,jieguo=1;
if(num<min){
return 0;
}
for(j=min;j<num;j++){
if(num%j==0){
jieguo+=fenjie(num/j,j);
}
}
return jieguo;
} |
1 | 220 | int main()
{
int f(int x,int y);
int n,i;
int a[100];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
printf("%d\n",f(a[i],2));
}
scanf("%d",&i);
return 0;
}
int f(int x,int y)
{
int s,j,k,l,m,n;
if(x==1) s=1;
else if(y>x) s=0;
else {
for(l=1;l<=x;l++)
{
k=0;
if(x%l==0) k=k+1;
}
if(k==2) s=1;
else
{
s=0;
for(j=y;j<=x;j++)
{
if(x%j==0){ s=s+f(x/j,j);}
}
}
}
return s;
} |
1 | 221 | int divide(int n,int min)//?n?????????????min
{
int i,method=0;//method??n????
if(n>=min)
method++;
for(i=min;i<n;i++)
{
if(!(n%i))
method+=divide(n/i,i);
}
return method;
}
int main()
{
int number=0,integer;//??????,integer??????
int i;
cin>>number;
for(i=0;i<number;i++)
{
cin>>integer;
cout<<divide(integer,2)<<endl;
}
return 0;
} |
1 | 222 | //*****************************
//* ??????? *
//* ?????? *
//* ???2010-12-7 *
//*****************************
int num=1,flag=2;//????1?????,?????
void way(int);
int main()
{
int a,n;
cin>>n;
while(n--)
{
cin>>a;
way(a);
cout<<num<<endl;
num=1;
flag=2;//???
}
return 0;
}
void way(int a)
{
int i,max;
max=sqrt(a);
for(i=flag;i<=max;i++)//?????????????????????
{
if(a%i==0)//????????
{
flag=i;//??
num++;
way(a/i);//???????????????????
}
}
}
|
1 | 223 | int ways(int n,int p)
{
if(n<p) return 0;
while(n%p!=0) p++;
if(n==p) return 1;
return ways(n/p,p)+ways(n,p+1);
}
int main()
{
int n,m;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>m;
cout<<ways(m,2)<<endl;
}
return 0;
} |
1 | 224 |
int fen(int m,int k)
{
int i,t=1,n=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+fen(m/i,k);
}
}
return t;
}
int main()
{
int fen(int m,int k);
int n,i,x;
scanf("%d\n",&n);
for(i=0;i<n;i++)
{
scanf("%d",&x);
printf("%d\n",fen(x,1));
}
}
|
1 | 225 | int f(int c,int t);
void main()
{
int n,c;
scanf("%d",&n);
for(;n>0;n--)
{
scanf("%d",&c);
if(c==1 || c==2)
printf("1\n");
else
printf("%d\n",f(c,2));
}
}
int f(int c,int t)
{
int count=1,i;
for(i=t;i<c;i++)
{
if(c%i==0)
count+=f(c/i,i);
}
if(i==c) return count;
else return 0;
} |
1 | 226 | void f(int i,int m);
int sum;
int main()
{
int n,i,m,k;
scanf("%d",&n);
for(i=0;i<n;i++)
{ sum=1;
scanf("%d",&m);
f(2,m);
printf("%d\n",sum);
}
}
void f(int i ,int m)
{
int k,s;
s=(int)sqrt(m);
for(k=i;k<=s;k++)
{
if(m%k==0)
{
sum++;
f(k,m/k);
}
}
} |
1 | 227 | //*************************************
//* ????1.cpp *
//* ??????1200012844 *
//* ?????2012?11?28? *
//* ????????? *
//**************************************
int factor(int, int);
int main()
{
int n, i, a;
cin >> n;//n???
for ( i = 0; i < n; i ++ )
{
cin >> a;//?????
cout << factor(a, 2) << endl;//??????
}
return 0;
}
int factor(int a, int b)
{
int c, i;
int num = 1;//???????
if (a == 1)
return 0;
c = sqrt(a);
for ( i = b; i <= c; i++ )//?2??????????????????
if ( a % i == 0 )//??????i?????
num += factor(a / i, i);
return num;
} |
1 | 228 | /************************************
*??????? *
*?????? 1200012921 *
*???2012-11-30 *
*************************************/
int part(int x, int t) //x????????
{
int i;
int number = 1; //?x???????????number?
if (x == 1) //x=1?????
{
return 0;
}
if (x == 2) //x=2?????????
{
return 1;
}
for (i = t; i <= sqrt(x); i++) //???????
{
if (x % i == 0) //??????
{
number += part(x / i, i); //??
}
}
return number; //???????number
}
int main()
{
int i, n, a;
cin >> n; //n???
for (i = 1; i <= n; i++) //?????????a?????????
{
cin >> a;
cout << part(a, 2) << endl;
}
return 0;
} |
1 | 229 | int fenjie(int,int);
int main()
{
int times,k,num;
cin>>times;
for(k=1;k<=times;k++)
{
cin>>num;
cout<< fenjie(num,1)<<endl;
}
return 0;
}
int fenjie(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+fenjie(x/i,i);
}
}
else
{
for(i=y;i<=x;i++)
{
if(x%i==0) a=a+fenjie(x/i,i);
}
}
return a;
}
}
|
1 | 230 | int num=0;
int sum(int a,int i)
{
if(a==1)
{
num++;
}
else
{
while(i<=a)
{
if(a%i==0)
{
sum(a/i,i);
}
i++;
}
}
return num;
}
int main()
{
int a,t,j,i,count;
cin>>t;
for(j=0;j<t;j++)
{
count=1;
cin>>a;
i=2;
while(i<=(a/2))
{
if(a%i==0)
{
num=0;
sum(a/i,i);
count=count+num;
}
i++;
}
cout<<count<<endl;
}
return 0;
}
|
1 | 231 |
int count;
void f(int n, int min) {
int i;
if (n == min) { count++; return;}
if (n % min!=0) { return;}
for (i = min; i <= n; i++)
f(n/min, i);
}
int main() {
int N,i,num,j;
scanf("%d",&num);
for(j=1;j<=num;j++){
count = 0;
scanf("%d",&N);
for (i = 2; i <= N;i++)
f(N, i);
printf("%d\n",count);
}
return 0;
}
|
1 | 232 | int num=1;
int sushu(int n)
{
int i,sum=0;
for(i=1;i<=sqrt(n*1.0);i++)
if(n%i==0)
sum++;
if(sum==1)
return 1;
else
return 0;
}
void fenjie(int i,int k)//i???????k??????????? i?sqrt?n???
{
int mid,j;
mid=sqrt(k*1.0);
for(j=i;j<=mid;j++)
{
if(sushu(k))
break;
else
{
if(k%j==0)
{
num++;
fenjie(j,k/j);
}
}
}
}
int main()
{
int n,i;
int a[100];
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
for(i=0;i<n;i++)
{
fenjie(2,a[i]);
cout<<num<<endl;
num=1;
}
return 0;
}
|
1 | 233 | /*
* ways.cpp
*
* Created on: 2013-11-24
* Author: Mac
*/
int factor(int a, int f)
{
if(a == f)
return 1;
if (a < f)
return 0;
if(a%f == 0)
return factor(a, f+1) + factor(a/f, f);
else return factor(a, f+1);
}
int main()
{
int x, a;
cin >> x;
while(x > 0)
{
cin >> a;
cout << factor(a, 2) << endl;
x --;
}
}
|
1 | 234 | int main()
{
int n,i,a,factor(int N,int min);
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a);
printf("%d\n",factor(a,2));
}
return 0;
}
int factor(int N,int min)
{
int i,result;
result=1;
if(N<min)
{
return 0;
}
for(i=min;i<N;i++)
{
if(N%i==0)
{
result+=factor(N/i,i);
}
}return result;
}
|
1 | 235 | void main()
{
int f(int m,int i);
int n,a,b,i;
scanf("%d",&n);
for(i=1;i<=n;i++)
{scanf("%d",&a);
b=f(a,2);
printf("%d\n",b);}
}
int f(int m,int i)
{ int s,j;
if(m<i) s=0;
else
{if(m<i*i) s=1;
else
{for(s=1,j=i;j<=m;j++)
{if(m%j==0)
s=s+f(m/j,j);
}
}
}
return(s);
} |
1 | 236 | int a[1000];
int l=0,x;
int fff(int k,int w,int t,int x);
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(1,q-1,1,x);
printf("%d\n",l,x);
}
}
int fff(int k,int w,int t,int x)
{
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(k+1,w,i,x);
x=x*a[i];
}
}
}
|
1 | 237 | int col(int a,int b);
int main()
{int n,i,m,l;
scanf("%d",&n);
for(i=1;i<=n;i++)
{scanf("%d",&m);
l=col(m,2)+1;
printf("%d\n",l);
}
return 0;
}
int col(int a,int b)
{int i,t,tt=0,sig=0;
for(i=b;(i<a/2)&&((a/i)>=i);i++)
{
if(a%i==0)
{t=a/i;
tt=tt+1+col(t,i);
sig=1;
}
}
if(sig==0)
tt=0;
return(tt);
} |
1 | 238 |
/*
????
??
?????????????
f[i,j]????i????j?????????
??????????
i?j????N?????O(sqrt(n))???
?????
?????O(n^(3/2))
?????O(n)
*/
int main()
{
int f[200][200] = {0};
int div[40000] = {0};
int divth[200] = {0};
int kase = 0;
cin >> kase;
for (; kase > 0; kase --)
{
int n = 0;
cin >> n;
memset(f,0,sizeof(f));
memset(div,0,sizeof(div));
memset(divth,0,sizeof(divth));
int m = 0;
for (int i = 1; i <= n; i ++)
if (n % i == 0)
{
div[i] = ++m;
divth[m] = i;
}
f[1][1] = 1;
for (int i = 2; i <= m; i++)
for (int j = 2; j <= i; j++)
for (int k = j; k > 1; k--)
if (divth[i] % divth[k] == 0)
{
int ii = divth[i] / divth[k];
int jj = k;
if (div[ii] < jj) jj = div[ii];
f[i][j] += f[div[ii]][jj];
}
cout << f[m][m] << endl;
}
return 0;
} |
1 | 239 | //**********?????????*********************
//**********???????*************************
//**********?????2012?11?27?***************
//**********???1200062701**********************
int ifsushu(int n) //????????????1???
{
if(n == 1)
{
return 1;
}
else
{
for(int f = n - 1;f >= 2; f--) //??n?????
{
if(n % f == 0) break;
if (f == 2)
{
return 1;
}
}
}
return 0;
}
int sum = 0;
int zhaoyinshu(int x, int max)
{
if(x == 1)
{
sum++;
return 0;
}
for(int i = max; i >= 2; i--)
{
if(x % i == 0) // ??i?????
{
zhaoyinshu(x / i, i);
}
}
}
int main()
{
int time, number, t;
cin >> time;
for(int j = 0; j < time; j++)
{
cin >> number;
if(ifsushu(number) == 1)
{
cout << "1" << endl;
}
else
{
zhaoyinshu(number , number / 2);
cout << sum + 1 << endl; //????????????~
sum = 0;
}
}
return 0;
}
|
1 | 240 | /*
* 1000012850_34.1.cpp
* ????????????a??????????????? ?????????
* Created on: 2010-11-27
* Author: william
*/
int resolution_into_factors(int j,int i)
{
int m, sum=0, k=0;
for(m=j ;m<=sqrt(i); m++)
{
if(i%m==0)
{
sum=resolution_into_factors(m, i/m)+sum+1;
k++;
}
}
if(k==0) return 0;
return sum;
}
int main()
{
int n, k, i;
cin>>n;
for(k=1; k<=n; k++)
{
cin>>i;
cout<<resolution_into_factors(2,i)+1<<endl;
}
return 0;
} |
1 | 241 |
int fg(int k,int m)
{
int j,d=0;
if (m==1)
{
d=1;
}
for(j=k;j<=m;j++)
{
if (m%j==0)
d=d+fg(j,m/j);
}
return(d);
}
int main()
{
int n,i,a[40000],b[40000],s;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
for(i=1;i<=n;i++)
{
b[i]=fg(2,a[i]);
printf("%d\n",b[i]);
}
return 0;
} |
1 | 242 | int wtf(int p,int a);
int main()
{
int n,i,a,p;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a);
printf("%d\n",wtf(2,a));
}
return 0;
}
int wtf(int p,int a)
{
int i,ways=0,j=0;
int m=(int)sqrt(a);
for(;p<=m;p++)
{if(a%p==0 && a>=p*p ) {ways=ways+wtf(p,a/p);j++;}}
if(j==0)
return 1;
else
return ways+1;
}
|
1 | 243 | int f(int a,int b)
{
int i,p,q;
for(i=b,p=0;i<=sqrt(a);i++)
{
if(a%i==0)
{
q=f(a/i,i);
p=p+q;
}
}
p++;
return(p);
}
void main()
{
int i,a,n,k;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a);
k=f(a,2);
printf("%d\n",k);
}
} |
1 | 244 | int f(int m,int l)
{
int re=0,j;
if(l==4)
re=1;
if(l>4)
{
for(j=m;j<=sqrt(l);j++)
{
if(l%j==0)
{
re=re+1+f(j,l/j);
}
}
}
return re;
}
int main()
{
int n,i,a[100]={0};
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
printf("%d\n",(f(2,a[i])+1));
}
}
|
1 | 245 | int reek(int i,int j)
{
int k,g=0;
for (k=j;k<i;k++)
{
if ((i%k==0)&&(k!=1))
{
g=1;
break;
}
else continue;
}
if (g==0) return 1;
else
{
int num=1;
for(k=j;k<=sqrt(i);k++)
{
if ((i%k==0)&&(k!=1))
num+=reek(i/k,k);
else continue;
}
return num;
}
}
int main()
{
int n,i,a[1000];
cin>>n;
for(i=0;i<n;i++)
{
cin>>a[n];
cout<<reek(a[n],1)<<endl;
}
return 0;
}
|
1 | 246 | int cc;//cc¾íêÇò»12?Ä·Ö½a?Ä·½·¨ÖÖêy
void fen(int x,int h);
int main()
{
int n=0,k=0;
cin>>n;
for(k=1;k<=n;k++)
{
cc=0;
int ff;
cin>>ff;
fen(ff,2);
cout<<cc<<endl;
}
return 0;
}
void fen(int x,int h)
{
for(int i=2;i<=x;i++)
{
if((x%i==0)&&(i>=h)&&(i<x))
fen(x/i,i);
if((x%i==0)&&(i>=h)&&(i==x))
cc++;
}
} |
1 | 247 | int main()
{
int a[10000],b[10000],p,q,m,n,i,j;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("\n%d",&a[i]);
}
for(i=0;i<n;i++){
printf("%d\n",ans(a[i],2));
}
return 0;
}
int ans(int sum,int min)
{
int w,x,u=1;
for(w=min;w<sum/2;w++){
x=sum%w;
if(x==0){
if(w<=sum/w)
u+=ans(sum/w,w);
}
}
return u;
} |
1 | 248 | int numcheck(int num,int a)//???????num??????????a??????
{
int i=0,sum=0;
if(num==1)//??1????????
return 1;
else if(num<a)
return 0;
else
{
for(i=a;i<=num;i++)//?????????????????
{
if(num%i==0)
sum=sum+numcheck(num/i,i);
}
}
return sum;
}
int main()
{
int n=0,i=0,num=0,sum=0;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>num;
sum=numcheck(num,2);
cout<<sum<<endl;
}
return 0;
} |
1 | 249 | int counts = 1;
int ty(int, int);
int main()
{
int i, m, n, c;
cin >> m;
for(i = 1 ; i <= m ; i++)
{
cin >> n;
counts = 1;
c = ty(n, 2);
cout << c << endl;
}
return 0;
}
int ty(int n, int j)
{
int i, flag = 0;
if(n == 1)
{
return 0;
}
if(n == 2)
{
return 1;
}
for(i = j ; i <= (int)sqrt(n) ; i++)
{
if(n % i == 0)
{
counts++;
ty(n / i, i);
}
}
return counts;
}
|
1 | 250 | int i=0;
int f(int n,int m)
{int k=0;
if(m==1)
i++;
else
{for(k=n;k<=m;k++)
{if(m%k==0)
{n=k;
f(n,m/n);}}}
return(i);}
int main()
{
int n,b,c;
cin>>n;
int a;
for(b=0;b<n;b++)
{cin>>a;
c=f(2,a);
cout<<c<<endl;
i=0;}
return 0;
}
|
1 | 251 | int f(int m,int min);
int main()
{
int n,m,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&m);
printf("%d\n",f(m,2));
}
return 0;
}
int f(int m,int min)
{
int count=1,i;
if(m==1)
return 1;
else if(m == 2)
return 1;
else
{
for(i=min;i<=sqrt(m);i++)
{
if(m%i==0)
{
count += f(m/i,i);
}
}
return count;
}
} |
1 | 252 | int sdw(int a,int b)
{
int i;
int m=1;
for(i=a;i<b/2;i++)
{
if(b%i==0)
{
if(i<=b/i)
m=sdw(i,b/i)+m;
}
}
return m;
}
int main()
{
int n,i,p,b;
int a[1000];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
b=a[i];
p=sdw(2,b);
printf("%d\n",p);
}
return 0;
} |
1 | 253 |
int fun(int m,int n){
//m????n????
//??????????????????????;
if (m>sqrt(n)) return 0;
//????????????
if (n%m==0) return fun(m+1,n)+fun(m,n/m)+1;
else return fun(m+1,n);
//????????????????????????????????????????+1?
//??????????+1
}
//????????????
main(){
int i,x,y;
cin>>x;
for (i=1;i<=x;i++){
cin>>y;
cout<<fun(2,y)+1<<endl;//??a=a???
}
return 0;
}
|
1 | 254 | int main()
{
int n,i,fenjie(int x,int y),*a,re=0,j;//x?????????y???????????
scanf("%d",&n);
a=(int*)malloc(n*sizeof(int));
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
printf("%d\n",fenjie(a[i],2)+1);
}
return 0;
}
fenjie(int x,int y)
{
int i,flag=0,re=0,flag2=0,k=0;
if(x<y) return 0;
else if(x==y) return 0;
else
{
for(i=y;i<x;i++)
{
if(x%i==0) flag2+=1;
}
if(flag2==0) return 0;
else
{
for(i=y;i<=x;i++)
{
if(x%i==0)
{
re+=fenjie(x/i,i);
if(x/i>=i) k+=1;
}
}
re+=k;
return(re);
}
}
} |
1 | 255 |
/**
* @author ??
* @date 2010-12-1
* @description
* ??????:????
*/
int sum;
void calculate(int, int);
int main()
{
int n;
cin >> n;
for (int i = 0; i < n;i++)
{
int m;
sum = 1;
cin >> m;
calculate(m, 2);
cout << sum << endl;
}
return 0;
}
void calculate(int m,int begin)
{
int i;
int n = sqrt((double)m);
for ( i = begin; i <= n; i++ )
{
if ( m % i == 0)
{
sum++;
calculate(m / i,i);
}
}
} |
1 | 256 | void f(int,int);
int sum=0,res=1;
int main()
{
int n,a,i,j;
cin>>n;
for(i=0;i<n;i++) //n???
{
res=1; //??????a=a
cin>>a;
for(j=2;j<=(int)sqrt((float)a);j++) //??????
{
if(a%j==0)
{
sum=0;
f(a/j,j); //????????
res+=sum;
}
}
cout<<res<<endl;
}
return 0;
}
void f(int x,int y)
{
if(x==1)
sum++;
while(y<=x) //?????????????
{
if(x%y==0)
f(x/y,y);
y++;
}
return;
}
|
1 | 257 | int sum=0,k=2;
int fenjie(int n,int k)
{
int x,i,sum=0,p=0;
x=(int)pow(n,0.5);
for(i=k;i<=x;i++)
{
if(n%i==0) {k=i;sum=sum+fenjie(n/i,k);p=1;}
}
if(p==0) return 1;
if(p==1) return sum+1;
}
int main()
{ int m,n,i;
cin>>m;
for(i=0;i<=m-1;i++)
{
cin>>n;
cout<<fenjie(n,2)<<endl;
sum=0;
}
return 0;
}
|
1 | 258 | int num = 0;
void check(int m, int n)
{
for(;m <= n; m++)
{
if(n % m == 0)
{
if(n / m == 1)
{
num++;
return;
}
else
check(m, n / m);
}
}
}
int main()
{
int n, m;
cin >> n;
for(; n; n--)
{
cin >> m;
check(2, m);
cout << num << endl;
num = 0;
}
return 0;
} |
1 | 259 | /*
* fenjieyinshi1.cpp
*???????
* Created on: 2011-12-1
*??:???
*/
int remember=0;//???????????0
int number(int const1,int a)//?????
{
if(a==1)//??????1??????????????
{
remember++;//
return 1;//??=1
}
else
{
for(int i=const1;i<=a;i++)//????1??????????
{
if(a%i==0)//??????????
number(i,a/i);//?????????
}
}
}
int main()
{
int n;
cin>>n;//?????????
int cases[n];//??????????
for(int j=0;j<n;j++)
cin>>cases[j];//???????
for(int j=0;j<n;j++)
{
number(2,cases[j]);//????
cout<<remember<<endl;//????
remember=0;//?????????
}
return 0;
} |
1 | 260 | int check(int i, int a)
{
int means = 1;
if ( a == 1 )
return 0;
if ( a == 2 )
return 1;
for ( ; i <= (int)sqrt(a); i++ )
{
if ( a % i == 0 )
means += check(i, a/i);
}
return means;
}
int main()
{
int n, i, a;
cin >> n;
for ( i = 1; i <= n; i++ )
{
cin >> a;
cout << check(2, a) << endl;
}
} |
1 | 261 | int total,p;
void part(int y){
int i2,up;
if (y==1) return;
up=(int)sqrt(y);
for (i2=2;i2<=up;i2++){
if (p<=i2){
if (y%i2==0){
total++;
p=i2;
part(y/i2);
p=0;
}
}
}
}
int main(){
int n,i,a;
scanf("%d",&n);
for (i=1;i<=n;i++){
total=0;
p=0;
scanf("%d",&a);
part(a);
printf("%d\n",total+1);
}
return 0;
}
|
1 | 262 | int t,m,n,i,j,k,xx,x1,x2,x,y,s,n0;
void init(int a[],int b[])
{ freopen("tt.in","r",stdin);
scanf("%d%d",&m,&n);
for (i=1;i<=m;i++)
scanf("%d",&a[i]);
for (i=1;i<=n;i++)
scanf("%d",&b[i]);
}
void output(int a[],int k)
{
int i;
freopen("tt.out","w",stdout);
for(i=1;i<=k;i++) if (i==1) printf("%d",a[i]); else printf(" %d",a[i]);
}
void proce(int n,int b)
{
int i;
if (n==1) s++;
else
for (i=b;i<=n0;i++)
if (!(n%i)) proce(n/i,i);
}
int main()
{
//freopen("tt.in","r",stdin);
//freopen("tt.out","w",stdout);
scanf("%d",&n);
for (i=1; i<=n;i++)
{
scanf("%d",&x);
s=0;
n0=x;
proce(x,2);
printf("%d\n",s);
}
return 0;
} |
1 | 263 |
int f(int, int);
int main()
{
int x, n, i;
cin >> n;
for (i = 1; i <= n; i++)
{
cin >> x;
cout << f(x, 2) << endl;
}
return 0;
}
int f(int x, int i)
{
int ans = 0;
if (x == 2)
{
return 1;
}
else
{
for (; i <= sqrt(x); i++)
{
if (x % i == 0)
{
ans = ans + f(x / i, i);
}
}
return ans + 1;
}
}
|
1 | 264 | /*
* fenjie.cpp
*
* Created on: 2013-11-24
* Author: ??
*/
int num=0;
void fj(int m,int i){
if(m==1)num++;
else {
for (int j=i;j<=m;j++){
if(m%j==0)fj(m/j,j);
}
}
}
int main(){
int n,m;cin>>n;
for(int ii=0;ii<n;ii++){
cin>>m;fj(m,2);
cout<<num<<endl;
num=0;
}
return 0;
}
|
1 | 265 | int geshu;//?????
void yinshu(int num,int a)//??????
{
int i;//???
if (num==1) geshu++;//?1??????
else
{
for(i=a;i<=num;i++)
{
if (num%i==0)//???????
{
//cout<<"neibu???"<<i<<" "<<endl;
yinshu(num/i,i);//?num/i?????
}
}
}
}
int main()
{
int shu,j,num1[10000];//shu??????j??????num?????
cin>>shu;
for(j=0;j<shu;j++)
{
geshu=0;
cin>>num1[j];
//cout<<"???"<<j<<" ";
yinshu(num1[j],2);//?????
cout<<geshu<<endl;//??
}
cin.get();cin.get();cin.get();cin.get();cin.get();
return 0;
}
|
1 | 266 | int c[1000]={0},d[1000],j;
main()
{
void f();
int i,s;
scanf("%d",&s);
for(j=0;j<s;j++)
{
scanf("%d",&d[j]);
for(i=2;i<=sqrt(d[j]);i++)
{
if(d[j]%i==0)
{
c[j]++;
f(i,d[j]/i);
}
}
}
for(j=0;j<s;j++)
{
printf("%d\n",c[j]+1);
}
}
void f(int s,int m)
{
int k;
for(k=s;k<=sqrt(m);k++)
{
if(m%k==0)
{
c[j]++;
f(k,m/k);
}
}
}
|
1 | 267 | int s=0;
void f(int x,int y)
{
int i,j,k;
if(x==1)
s++;
else
{
for(;y<=x;y++)
{
if(x%y==0)
{
f(x/y,y);
}
}
}
}
int main()
{
int n,k,q,j;
scanf("%d",&q);
for(j=0;j<q;j++)
{
scanf("%d",&n);
f(n,2);
printf("%d\n",s);
s=0;
}
return 0;
} |
1 | 268 | int fj(int n,int m)
{
int i,j,k=0;
if(n==1) return 1;
for(i=m;i<=n;i++)
{
if(n%i==0)
k+=fj(n/i,i);
}
return k;
}
int main()
{
int n,i;
scanf("%d",&n);
for(;n>0;n--)
{
scanf("%d",&i);
printf("%d",fj(i,2));
if(n-1) printf("\n");
}
} |
1 | 269 | 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;
for(m=p;m<=n;m++)
if(n%m==0){
if(m<n) sum=sum+f(n/m,m); //n?????m?????=n/i?????=m?????
if(m==n) sum=sum+1; //n?????n?????=1
}
return sum;
}
|
1 | 270 | int fenjie(int k, int l);
int main()
{
int n, i;
cin >> n;
for(i = 1; i <= n; i++)
{
int a;
cin >> a;
cout << fenjie(a, 2) << endl;
}
return 0;
}
int fenjie(int k, int l)
{
int num = 1, d, e;
if(k < l)
{
return 0;
}
d = (int) (sqrt((double) k));
for(e = l; e <= d; e++)
{
if(k % e == 0)
{
num += fenjie(k / e, e);
}
}
return num;
} |
1 | 271 | int m=0;
int main()
{
void count(int a,int b);
int r,i,k,n;
scanf("%d",&r);
for(i=0;i<r;i++)
{
scanf("%d",&n);
for(k=2;k<=sqrt(n);k++)
{
if(n%k==0)
{
m++;
count(k,n/k);
}
}
printf("%d\n",m+1);
m=0;
}
}
void count(int a,int b)
{
int j;
double t=sqrt(b);
for(j=a;j<=t;j++)
{
if(b%j==0)
{
m++;
count(j,b/j);
}
}
}
|
1 | 272 | int f(int i,int t)
{
if(i<t)
{return 0;}
int b=1;
int a;
for(a=t;a<i;a++)
{
if(i%a==0)
{b=b+f(i/a,a);}
}
return b;
}
int main()
{
int n;
scanf("%d",&n);
int i=0;
int d[100];
do
{
scanf("%d",&d[i]);
i++;
}while(i<n);
i=0;
do
{
printf("%d\n",f(d[i],2));
i++;
}while(i<n);
return 0;
} |
1 | 273 | int f(int a,int min)
{
if(a<min)
{
return 0;
}
int k=1,i;
for(i=min;i<a;i++)
{
if(a%i==0)
{
k=k+f(a/i,i);
}
}
return(k);
}
int main()
{
int f(int a,int min);
int j,n;
int a[100],b[100];
scanf("%d",&n);
for(j=0;j<n;j++)
scanf("%d",&a[j]);
for(j=0;j<n;j++)
{
b[j]=f(a[j],2);
printf("%d\n",b[j]);
}
return 0;
} |
1 | 274 | //
// main.cpp
// 123
//
// Created by blues cookie on 12-11-12.
// Copyright (c) 2012? blues cookie. All rights reserved.
//
int calc(int a,int b)
{
if(a*a>b) return 1;
if(b%a==0) return (calc(a,b/a)+calc(a+1,b));
return calc(a+1,b);
}
int main(int argc, const char * argv[])
{
int n,a;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a;
cout<<calc(2,a)<<endl;
}
return 0;
} |
1 | 275 |
void factor(int a, int k);
int sum = 0;
int main()
{
int n, a, i = 0;
cin >> n;
for (i = 1; i <= n; i++)
{
cin >> a;
factor(a, 2);
cout << sum + 1 << endl;
sum = 0;
}
return 0;
}
void factor(int a, int k)
{
int b, j;
b = (int)sqrt((double)a);
for (j = k; j <= b; j++)
{
if (a % j == 0)
{
sum++;
factor(a / j, j);
}
}
j = k;
}
|
1 | 276 | //???2010?12?1?
//???1000010586_???
//???????
int m , num;
int make( int a );
int pan( int a );
int main()
{
int n , a , i;
cin >> n;
for( i = 1 ; i <= n ; i++ )
{
cin >> a;
num = 0;
m = a;
cout << make( a ) << endl;
}
return 0;
}
int pan( int a )
{
int n = 0 , i;
for ( i = 1 ; i <= sqrt( a ) ; i ++ )
{
if ( a % i == 0 )
n++;
}
if ( n == 1 )
return 0;
else
return 1;
}
int make( int a )
{
int i , j , ans;
ans = sqrt( a );
if ( pan( a ) == 0 )
{
num++;
return num;
}
else
{
num++;
for ( i = m / a ; i <= ans ; i++ )
{
if ( i == 1 ) continue;
if ( a % i == 0 )
{
m = a;
num = make( a / i );
}
}
if ( i == ans + 1 )
return num;
}
return num;
}
|
1 | 277 | /*
*????HW7_10.cpp
*??????1100019007?
*???2012-11-14
*???1090 ????
*/
int factorize(int m,int k)
{
int c=1;//a=a???
if(m<4)return 1;//?m??4??1
for(int i=k;i<=sqrt(m);i++)if(!(m%i))c+=factorize(m/i,k>i?k:i);//????????????????an>an-1,???k???
return c;//?????
}
int main(int argc, char *argv[]){
int n,m;
cin>>n;
while(n--){
cin>>m;//????
cout<<factorize(m,2)<<endl;//????
}
return 0;}
|
1 | 278 | int main()
{
int digui(int p,int q);
int n,i,j;
scanf("%d",&n);
for(i=0;i<n;i++)
{
int a,sum=1;
scanf("%d",&a);
for(j=2;j<a;j++)
{if(j*j>a)
break;
else if(a%j==0)
sum=sum+digui(j,a/j);
}
printf("%d\n",sum);
}
}
int digui(int p,int q)
{
int z=1,d;
if(p==q)
z=1;
else if(p>q)
z=0;
else
for(d=p;d<q;d++)
{if(d*d>q)
break;
else if(q%d==0)
z=z+digui(d,q/d);
}
return(z);
} |
1 | 279 | void qut(int a,int b); //????
int num=0; //?????????
int main()
{
int i,n,g[1000]; //?????????
cin>>n;
for(i=0;i<n;i++) //??????
cin>>g[i];
for(i=0;i<n;i++)
{
qut(g[i],1); //????
cout<<num<<endl;
num=0;
}
return 0;
}
void qut(int a,int b)
{
int i;
if (a>=b)
{
num++;
if (b==1)
b++;
for (i=b;i<=a;i++)
{
if (a%i==0)
{
qut(a/i,i); //??a%i==0,??
}
}
}
}
|
1 | 280 | int sum=0;
void f(int x,int y)
{
if(x==1)
sum++;
while(y<=x)
{
if(x%y==0)
f(x/y,y);
y++;
}
}
int main()
{
int n,i,a;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>a;
int j=2,num=1;
while(j<=a/2)
{
if(a%j==0)
{
sum=0;
f(a/j,j);
num+=sum;
}
j++;
}
printf("\n%d",num);
}
return 0;
}
|
1 | 281 |
int main ()
{
int factor(int n,int x);
int n;
int i,m;
int a[100];
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d",&n);
a[i]=factor(n,2);
}
for(i=0;i<m;i++)
printf("%d\n",a[i]);
return 0;
}
int factor(int n,int x)
{
int i,f=0;
if(n==1)
f=1;
else
for(i=x;i<=n;i++)
if(n%i==0)
f+=factor(n/i,i);
return f;
} |
1 | 282 | int num(int a,int b);
int main()
{
int t;
int a;
cin>>t;
for(int i=1;i<=t;i++) //??
{
cin>>a; //????
cout<<(num(a,2))<<endl; //????
}
return 0;
}
int num(int a,int b)
{
int f=0;
if(a>=b) //????????????
{
for(int i=b;i<=a;i++) //????
{
if(a==i) f++;
else if(a%i==0) f=f+num(a/i,i); //???????????
}
}
return f;
} |
1 | 283 | int f(int a,int c);
int j,b;
int main()
{
int i,n,m;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&m);
printf("%d\n",f(m,2));
}
return 0;
}
int f(int a,int c)
{
int j,b=0;
for(j=c;j<=sqrt(a);j++)
{
if(a%j==0)
{
b=b+f(a/j,j);
}
}
return b+1;
}
|
1 | 284 | int sum=0; //??????sum????????
int yueshu[100]={0};
int s=0;
void number(int num,int s)
{
int i;
for(i=s;i>=0;i--)
{
if(num<yueshu[i])
continue;
if(num==yueshu[i])
sum++;
else if(num>yueshu[i]&&num%yueshu[i]==0)
number(num/yueshu[i],i);
}
}
int main()
{
int n=0;
cin>>n;
int num=0;
while(cin>>num)
{
int i=0,j=0;
for(i=2;i<=num;i++)
if(num%i==0)
{
yueshu[j]=i;
j++;
}
s=j-1;
number(num,s);
cout<<sum<<endl;
sum=0;
}
return 0;
} |
1 | 285 | int fjys(int x,int y)
{
if(x<y)
return 0;
int i,n=1;
for(i=y;i<x;i++)
{
if(x%i==0)
{
n+=fjys(x/i,i);
}
}
return n;
}
int main()
{
int n,a[100];
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a[i];
cout<<fjys(a[i],2)<<endl;
}
return 0;
} |
1 | 286 | int divide(int d,int n)
{
int sum=0;
for(int i=d;i<n;i++){
if (n%i==0&&(n/i)>=i){
sum=sum+1;
sum=sum+divide(i,n/i);}}
return (sum);
}
int main()
{
int n,num;
cin>>n;
for(int i=0;i<n;i++){
cin>>num;
cout<<divide(2,num)+1<<endl;}
return 0;
}
|
1 | 287 |
int main()
{
int f(int p,int q,int t);
int n,i;
int g[100];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&g[i]);
for(i=0;i<n;i++)
{
printf("%d\n",f(2,g[i],1));
}
return 0;
}
int f(int p,int q,int t)
{
int h[100][100];
int i,k=0;
for(i=p;i*i<=q;i++)
{
k=0;
if(q%i==0)
{
h[k][0]=i;
h[k][1]=q/i;
k++;
if(k!=0)
{
t=f(h[k-1][0],h[k-1][1],t);
}
}
t=t+k;
}
return t;
} |
1 | 288 | int fj(int a, int b);
int main()
{
int n, i, a;
cin >> n;
for(i = 0; i < n; i++)
{
cin >> a;
cout << fj(a, 2) << endl;
}
return 0;
}
int fj(int a, int b)
{
int j, x, sum = 1, f = 0;
x = sqrt((double) a);
if((a == 1) || (a == 2) || (a == 3))
return 1;
else
{
for(j = b; j <= x; j++)
{
if(a % j == 0)
{
sum += fj(a / j, j);
f = 1;
}
}
if (f == 0)
return 1;
else
return sum;
}
} |
1 | 289 | int k=0;
int y;
int a(int x,int i);
void b(int x,int i);
int main()
{
int n,i,x,z;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&x);
y=x;
printf("%d\n",a(x,2));
}
return 0;
}
int a(int x,int i)
{
k=0;
b(x,i);
return k;
}
void b(int x,int i)
{
for(i=i;i<=x;i++)
{
if(x%i==0) b(x/i,i);
}
if(x==1) k=k+1;
} |
1 | 290 | int sum;
int yin(int c,int g)//?????
{
int j,k,f,e;
for(j=g;j<=c;j++)//??
{
if(c%j==0)
{
e=c/j;
if(e>1)
{
f=j;
yin(e,f);
}
else sum++;//?????????
}
}
return sum;//??
}
int main()
{
int n,a[1000],b[1000],i,d;
cin>>n;
for(i=0;i<n;i++) cin>>a[i];//??
for(i=0;i<n;i++) {d=2;sum=0;b[i]=yin(a[i],d);}
for(i=0;i<n;i++) cout<<b[i]<<endl;//??
return 0;
}
|
1 | 291 | /*???????a?????????????????a = a1 * a2 * a3 * ... * an???1 < a1 <= a2 <= a3 <= ... <= an?????????????????a = a???????
????
?1?????????n?????n???????????1?????????a (1 < a < 32768)
????
n???????????????????????????????????
????
2
2
20
????
1
4*/
int ct;
int count(int n, int p)
{
int i;
if(n==1) ct++;
for(i=p;i<=n;i++)
if(n%i==0) count(n/i,i);
}
int main()
{
int n,m,i;
cin>>m;
for(i=1;i<=m;i++)
{
ct=0;
cin>>n;
count(n,2);
cout<<ct<<endl;
}
}
|
1 | 292 | /*
* [email protected]
*
* Created on: 2011-11-27
* Author: Administrator
*/
int num0;//????
int factor(int x, int y)//?????
{
int countn = 1;//????????1
if ( x == 1 )
return 0;
if ( x == 2 )
return 1;//??1,2?????
for ( int i = y; i <= sqrt(x); i ++)
if ( x % i == 0 )
countn += factor(x / i, i);//?????
return countn;
}
int main()//?????
{//?????
int n, j;//????
cin >> n;//????
for ( j = 1; j <= n; j++)
{
cin >> num0;//???????
cout << factor(num0, 2) << endl;//??????
}
return 0;//???????????????????
}//????
|
1 | 293 | int f(int x,int y)
{
int a,n=1;
for(a=y;a<=sqrt(x);a++)
{
if(x%a==0)
{
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]=f(x[i],2);
}
for(i=0;i<m;i++)
{
printf("%d\n",n[i]);
}
return 0;
}
|
1 | 294 | int f(int a,int b)
{
if(a==b)return 1;
if(b>a)return 0;
if(a%b!=0)return f(a,b+1);
if(a%b==0)return f(a,b+1)+f(a/b,b);
}
int main()
{
int n=0,i=0,x,y;
cin>>n;
for(i=0;i<n;i++)
{
cin>>x;
y=2;
cout<<f(x,y)<<endl;
}
return 0;
} |
1 | 295 | void count(int, int);
int k;
int main()
{
int n, i, j, m;
int num;
cin >> n;
for (i = 0; i < n; i++)
{
k = 0;
cin >> num;
m = sqrt(num) + 1;
for (j = 2; j < m; j++)
if (num % j == 0)
{
k++;
count(num / j, j);
}
cout << k + 1 << endl;
}
return 0;
}
void count(int num, int i)
{
int j;
int n = sqrt(num);
for (j = i; j <= n; j++)
{
if (num % j == 0)
{
k++;
count((num / j), j);
}
}
} |
1 | 296 | void account (int ,int);
int p;
int main()
{
int m;
int n;
cin>>n;
while(n>0)
{
p=0;
cin>>m;
account(m,1);
cout<<p<<endl;
n--;
}
return 0;
}
void account (int m,int i)
{
if(m==1)
p++;
else for(int j=2;j<=m;j++)
{
if((m%j==0)&&(j>=i))
account(m/j,j);
}
} |
1 | 297 | int f(int m,int min); //????????
int main()
{
int n,i,a[100],sum[100];
cin>>n; //??????
for(i=0;i<n;i++)
cin>>a[i];
for(i=0;i<n;i++)
{
sum[i]=f(a[i],2); //??????????????
cout<<sum[i]<<endl;
}
return 0;
}
int f(int m,int min) /*???????????????????????????
??????????????*/
{
int i,sum=0;
if(m==min||m==1) //???????????????????1???1?
return 1;
else if(m<min) //????????????????????
return 0;
else if(m>min) //??????????????????????????????????
{ for(i=min;i<=m;i++)
if(m%i==0)
sum+=f(m/i,i);
return sum;
}
} |
1 | 298 | int main()
{
int ys(int s,int p);
int n,m,i,t;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&m);
t=ys(m,2);
printf("%d\n",t);
}
return 0;
}
int ys(int s,int p)
{
int j,a=1,b;
for(j=p;j*j<=s;j++)
{
if(s%j==0)
{
b=s/j;
a=a+ys(b,j);
}
}
return(a);
} |
1 | 299 |
int calc(int p,int t);
int main()
{
int m,n,ans;
scanf("%d",&m);
while (m--)
{
scanf("%d",&n);
ans=calc(2,n);
printf("%d\n",ans);
}
return 0;
}
int calc(int p,int t)
{
int i,a;
a=1;
for (i=p;i<=sqrt(t);i++)
if (t%i==0)
a=a+calc(i,t/i);
return a;
} |