label
stringlengths 1
2
| index
stringlengths 1
5
| code
stringlengths 87
8.24k
|
---|---|---|
1 | 0 | int fi(int a,int j);
void main()
{
int a,n;
scanf("%d",&n);
while(n--){
scanf("%d",&a);
printf("%d\n",fi(a,2));
}
}
int fi(int a,int k)
{
int i,b=1;
if(a==1)
return 0;
for(i=k;i*i<=a;i++)
if(a%i==0)
b=b+fi(a/i,i);
return b;
} |
1 | 1 | int yinshu(int be,int by)//???????
{
int i,sum=0;
for(i=by;i*i<=be;i++)
{
if(be%i==0)
{
sum=sum+1+yinshu(be/i,i);
}//be?i?????????????????be/i
}
return sum;
}
int main()
{
int n;
cin>>n;//??
while(n--)//???
{
int num,sign;//sign??????
cin>>num;
for(int j=num;j>1;j--)
{
if(num%j==0)
sign=j;
}//??????
cout<<yinshu(num,sign)+1<<endl;//????
}
return 0;
}
|
1 | 2 | /*
/??? 10(1)
/?? ???
/?? 2012?11?26?
/??? ????
*/
int main()
{
int fenjie(int x, int y);
int a, n, i;
cin >> n;
for(i = 1; i <= n; i++)
{
cin >> a;
cout << fenjie(a, 2) << endl;
}
return 0;
}
int fenjie(int x, int y)
{
int b, i, count = 1; // ?????????
if(x == 1)
return 0;
if(x == 2)
return 1;
b = sqrt((double) x);
for(i = y; i <= b; i++)
{
if(x % i == 0) // ?????????????????????count???
{
count += fenjie(x / i, i); // ????????????i??????????
}
}
return count;
} |
1 | 3 | int num(int a,int b,int c)//??????????
{
int sum=0,j;//sum????
if(a>c)return 0;//???????????????0
if(b==1)return 1;//????????????????
for(j=a;j<=c;j++)//?????????????
if(c%j==0)sum=sum+num(j,b-1,c/j);
return sum;
}
int main()
{
int k,n,m,e=0,i;//e??????
cin>>n;
while(e<n)
{
cin>>m;
k=0;//k??m????????????????
int f=m;
for(i=2;i<=f;i++)
if(f%i==0)
{
k++;
f=f/i;
i=1;
}
cout<<num(1,k,m)<<endl;//????????
e++;
}
return 0;
}
|
1 | 4 | int times;
int move(int a,int num)//a??????
{int i;
if(num==1)
times++;
for(i=2;i<=num;i++)
if(num%i==0&&i>=a)
move(i,num/i);
return times;
}
int main()
{
int n,i;
cin>>n;
int a[n];
for(i=0;i<n;i++)
cin>>a[i];
int b[n];//??????
for(i=0;i<n;i++)
{times=0;
b[i]=move(1,a[i]);}
for(i=0;i<n;i++)
cout<<b[i]<<endl;
return 0;
} |
1 | 5 |
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;
}
main()
{
int n;
scanf("%d",&n);
int i;
int a;
int b;
for(i=0;i<n;i++)
{
scanf("%d",&a);
int min=2;
b=f(a,2);
printf("%d",b);
printf("\n");
}
}
|
1 | 6 | int m[100],i;
void sb(int,int);
int main()
{
int n,a[100];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
{
sb(a[i],2);
printf("%d\n",m[i]+1);
}
return 0;
}
void sb(int c,int d)
{
int v;
for(v=d;v<=sqrt(c);v++)
{
if(c%v==0)
{
m[i]++;
sb(c/v,v);}}
}
|
1 | 7 | //***************************************
//* ?????2010?12?01? *
//* ????????? *
//* ????? ???1000012902 *
//***************************************
int factors(int, int, int); //????factors?????????????
int main()
{
int num, n, i, j, b[10000];
cin >> n; //??????
for (i = 0; i < n; i++)
{
cin >> num;
int part = 0; //??????????
int t = num; //????
//??????1????????????
for (j = 2; j <= num; j++)
{
while (t % j == 0)
{
t /= j;
part++;
}
}
b[i] = factors(1, part, num); //?????????????, ??????????
}
//?????????
for (i = 0; i < n; i++)
{
cout << b[i] << endl;
}
return 0;
}
//factor1????????????????????factor1, part??????????????????????????, num????????
int factors(int factor1, int part, int num)
{
int sum = 0; //????????0, ???0
if (num < factor1) //?????????????????, ???0?????????????
return 0;
if (part == 1) //?????????, ??1??????????
return 1;
//???????????????????????????????????????????, ????????
for (int i = factor1; i <= num; i++)
if (num % i == 0)
sum = sum + factors(i, part - 1, num / i);
return sum;
} |
1 | 8 | int num=0;
void f(int k,int n)
{
int i,flag=0;
for(i=k;i<=n;i++)
{
if(n%i==0)
{
f(i,n/i);
flag=1;
}
}
if((flag==0&&k<=n)||n==1)
num++;
}
int main()
{
int i,n,m;
cin>>m;
for(i=1;i<=m;i++)
{
cin>> n;
f(2,n);
cout<<num<<endl;
num=0;
}
return 0;
}
|
1 | 9 | int n,t,cnt;
void f(int left,int last){
if(left<last) {if(left==1) cnt++;return;}
for (int i=last;i<=left;i++) if(left%i==0) f(left/i,i);
}
int main(){
scanf("%d",&t);
while (t--){
scanf("%d",&n);
cnt=0;f(n,2);
printf("%d\n",cnt);
}
return 0;
}
|
1 | 10 | int make(int x,int t)
{
int ans=0,i;
if (x==1) return 1;
for (i=t;i<=x;i++)
if (x%i==0) ans+=make(x/i,i);
return ans;
}
int main()
{
int i,k,j,p,n,t,m,x;
scanf("%d",&t);
for (p=1;p<=t;p++)
{
scanf("%d",&n);
x=make(n,2);
printf("%d\n",x);
}
} |
1 | 11 | int sum;
void f(int x,int min)
{ int p;
if (x==1) sum++;
else for (p=min;p<=x;p++)
if (x%p==0) f(x/p,p);
}
int main()
{ int n,i,j,k;
cin>>n;
for (i=1;i<=n;i++)
{sum=0;
cin>>k;
for (j=2;j<=k;j++)
if (k%j==0) f(k/j,j);
cout<<sum<<endl;
}
return 0;
}
|
1 | 12 | int sum=0;
int f(int a,int b)
{
for(int i=a;i>1;i--)
{
if(a%i!=0)
{continue;}
else
{
if(i>b)
{continue;}
else
{
int q;
q=a/i;
if(q==1)
{sum++;}
else {f(q,i);}
}
}
}
return sum;
}
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
int num;
cin>>num;
int c;
c=f(num,num);
cout<<c<<endl;
sum=0;
}
return 0;
}
|
1 | 13 | int fenjie(int out[16],int a,int n,int m,int sheng,int b[2])
//n??out?????????m?????????????2?????????,sheng???????
{
int i;
for(i=m;i<=a/2;i++)
{
if(sheng%i==0)
{
out[n]=i;
int qiu=1,k;
for(k=0;k<=n;k++)qiu=out[k]*qiu;
//cout<<i<<" "<<qiu<<" "<<n<<endl;
if(qiu==a){b[0]++;break;}
if(qiu>a)break;
else fenjie(out,a,n+1,i,sheng/i,b);
}
}
return 0;
}
int main()
{
int hang=0;
cin>>hang;
while(hang>0)
{
int a;
int b[2]={0};
cin>>a;
int out[16]={0};
fenjie(out,a,0,2,a,b);
cout<<b[0]+1<<endl;
hang--;
}
return 0;
}
|
1 | 14 | int elm[100]={0};
int counts=0,num=0;
void Try(int b,int s)
{
int j;
for(j=2;j<=num;j++)
{
if(j>=elm[s-1])
{
if(b%j==0)
{
elm[s]=j;
if(b/j==1)
counts++;
else if(b/j<j)
continue;
else
Try(b/j,s+1);
}
}
}
}
int main()
{
int n,i;
cin>>n;
for(i=0;i<n;i++)
{
counts=0;
cin>>num;
Try(num,1);
cout<<counts<<endl;
}
return 0;
}
|
1 | 15 | int s[100];
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;
}
main()
{int m,mm;
scanf("%d",&m);
for(int i=0;i<m;i++){
scanf("%d",&mm);
/*for(int i=0;i<m+1;i++){s[i]=0;printf("%d",s[i]);}*/
printf("%d\n",f(mm,2));}
}
|
1 | 16 | int fenjie(int n,int min)
{
int x=0,i;
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 shu;
int number,count=1;
scanf("%d",&number);
while(count<number)
{
scanf("%d",&shu);
printf("%d\n",fenjie(shu,2));
count++; }
scanf("%d",&shu);
printf("%d",fenjie(shu,2));
} |
1 | 17 |
int calculate(int a, int num) { // a is the max num
int sum = 0;
if(num == 1) return 1;
for(int i = num; i >= 2; i--) {
if(num % i == 0 && i <= a) {
sum += calculate(i, num / i);
}
}
return sum;
}
int main () {
int n;
cin >> n;
int num = 0;
for(int i = 0; i < n; i++) { // input part
cin >> num;
cout << calculate(num, num) << endl;
}
return 0;
} |
1 | 18 | int m=2;
int manners(int a){//????????????
int count=1,t=0;
t=sqrt((double) a);
for(int i=m;i<=t;i++){//?????????
if(a%i==0){
m=i;//?????????????????????
count=count+manners(a/i);//?????????????????
}
}
return count;//?????
}
int main(){
int n, b;
int i=1;
cin>>n;
while(i<=n){
cin>>b;
cout<<manners(b)<<endl;
m=2;//?????
i++;
}
return 0;
} |
1 | 19 | int sum = 0;
void fenjie(int t,int n)
{
int i = 0;
if(n == 1)
sum++;
for(i = t; i <= n; i++)
{
if(n % i == 0)
{
fenjie(i, n / i);
}
}
}
int main()
{
int n = 0, k = 0;
cin >> n;
while(n > 0)
{
cin >> k;
sum = 0;
fenjie(2,k);
n--;
cout << sum <<endl;
}
return 0;
} |
1 | 20 |
int ans;
void dfs(int, int);
int main()
{
int n, num;
cin >> n;
while (n--) {
cin >> num;
ans = 0;
dfs(num, 2);
cout << ans <<endl;
}
return 0;
}
void dfs(int x, int f)
{
if (x == 1) {
++ans;
return ;
}
for (int i = f; i <= x; ++i)
if (x % i == 0)
dfs(x / i, i);
return ;
} |
1 | 21 | //------------------
// 1057???
// 2010/12/1
// ???
//------------------
int devide(int m,int x,int i)
{
if(x==1&&m>=i) return 1;
else if(x>1)
{
int j=i;
int sum=0;
while(j<=m)
{
if(j!=1&&m%j==0) sum=sum+devide(m/j,x-1,j);
j++;
}
return sum;
}
return 0;
}
int main()
{
int n,a,i;
cin>>n;
for(i=0;i<n;i++)
{
int sum=0;
cin>>a;
for(int X=1;X<=16;X++)
sum+=devide(a,X,1);
cout<<sum<<endl;
}
return 0;
} |
1 | 22 | int ge,s,w;//ge???????????
void fen(int h,int a);//fen???s??????????
int main()
{
int n=0,k=0;//n???????? k????????? s?????????????
cin>>n;
for(k=1;k<=n;k++)
{
cin>>s;
ge=0;
fen(s,2);
cout<<ge<<endl;
}
return 0;
}
void fen(int h,int a)
{
for(int i=2;i<=h;i++)
{
if((h%i==0)&&(i>=a))
{
if(h/i!=1)
{fen(h/i,i);}
else
{ge++;}
}
}
}
|
1 | 23 | int num;
void divide(int n,int n2)
{
int i,m1;
m1=(int)sqrt((double)n);
for(i=n2;i<=m1;i++)
{if(n%i==0)
{num++;divide(n/i,i);}//?????????????????????????????
}
}
int main()
{
int n,i,m;
cin>>n;
for(i=0;i<n;i++)
{
num=1;
cin>>m;
divide(m,2);
cout<<num<<endl;
}
return 0;
} |
1 | 24 | int main()
{
int f(int a,int b);
int n,a;
cin>>n;
while(n>0)
{
cin>>a;
cout<<f(a,2)<<endl;
n--;
}
return 0;
}
int f(int a,int b)
{
int i;
int s=1;
if(a<b)
return 0;
for(i=b;i<a;i++)
{
if(a%i==0)
s=s+f(a/i,i);
}
return s;
} |
1 | 25 |
int s=0;
void find(int min,int dev)
{
int i;
for(i=min;i<=sqrt((float)dev);i++)
if(dev%i==0)
{
s++;
find(i,dev/i);
}
}
int main()
{
int n,i,m,j;
scanf("%d",&m);
for(j=1;j<=m;j++){
scanf("%d",&n);
for(i=2;i<=sqrt((float)n);i++)
if(n%i==0)
{
s++;
find(i,n/i);
}
printf("%d\n",s+1);s=0;}
//getchar();
//getchar();
return 0;
} |
1 | 26 | //============================================================================
// Name : 30fenjie.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
int factorize(int a, int b) {
int factor,i;
if(a==1) factor=1;
if(a!=1) factor=0;
for (i=b;i<=a;i++)
if (a%i==0)
factor=factor+factorize(a/i,i);
return factor;
}
int main() {
int n, a;
for (cin>>n; n--; cout<<factorize(a,2)<<endl) {
cin>>a;
}
} |
1 | 27 | int fun(int m,int n)
{
int i,sum=1;
if(n==1)
{
for(i=2;i*i<=m;i++)
{
if(m%i==0)
sum+=fun(m/i,i);
}
}
else
for(i=n;i*i<=m;i++)
{
if(m%i==0)
{
sum+=fun(m/i,i);
}
}
return sum;
}
int main()
{
int n,i,b;
int a[1000];
cin>>n;
for(i=0;i<n;i++)
{
cin>>b;
a[i]=fun(b,1);
}
for(i=0;i<n;i++)
cout<<a[i]<<endl;
}
|
1 | 28 | int t;
int f(int a,int b){
int i;
for(i=a;i*i<=b;i++){
if(b%i==0){
t++;
f(i,b/i);
}
}
return t;
}
void main()
{
int n,i,result[1000],a[1000];
scanf("%d",&n);
for(i=0;i<n;i++){
t=1;
scanf("%d",&a[i]);
result[i]=f(2,a[i]);
}
for(i=0;i<n;i++)
printf("%d\n",result[i]);
}
|
1 | 29 | int f(int s,int num) //s?????num?????
{
if(s==num) return 1;
if(s<num)
for(int i=s;i<=num;i++)
{
if(num%i==0)
{
if(i<num) return f(i,num/i)+f(i+1,num);
if(i==num) return 1;
}
}
if(s>num) return 0;
}
int main()
{
int n,i,num;
cin>>n;
for(i=0;i<n;i++)
{
cin>>num;
cout<<f(2,num)<<endl;
}
return 0;
} |
1 | 30 | /*
* 35_1.cpp
*????????????
* Created on: 2010-12-3
* Author: 1000012877
*/
int n,sum;//?????n??????????sum????????
int fenjie(int min,int max)//??????????????????????????min???max?????
{ int i;//????????????????
for (i=min;i<=sqrt(max);i++){//i ?????????????
if (max%i==0&&i<=max/i){
sum++;//?????????i??????1
fenjie(i,max/i);}//???????????max??????????
if(i>max/i) break;}
return sum;
}
int main() {
int i,k;
cin>>k;//k?????????
for (i=0;i<k;i++) {
cin>>n;
sum=1;//??????????1
sum=fenjie(2,n);//?????????
cout<<sum<<endl; }
return 0; }
|
1 | 31 |
int T,n;
int calc(int n, int min){
if(n==1)
return 1;
if(n<=min)
return 0;
int re=0;
for(int i=min+1; i<=n; i++)
if(n%i==0){
//printf("calc %d,%d += calc %d,%d\n",n,min,n/i,i);
re+=calc(n/i, i-1);
}
if(!re)re=1;
//printf("calc %d,%d=%d\n", n, min, re);
return re;
}
int main(){
scanf("%d",&T);
while(T--){
scanf("%d",&n);
printf("%d\n", calc(n,1));
}
return 0;
} |
1 | 32 |
int f(int a, int b)
{
int k = 0;
if (a >= 2 * b)
{
for (int i = b; i <= a / b; i++)
{
if (a % i == 0 && a/i >= i)
{
k += f(a/i, i) + 1;
}
}
}
else
{
k = 0;
}
return k;
}
int main()
{
int n, a, t;
cin >> n;
while (n--)
{
cin >> a;
t = f(a, 2) + 1;
cout << t << endl;
}
return 0;
}
|
1 | 33 |
int t=0;
int mini(int k,int i)//a?ˆ ˝o?÷÷?÷?®?¨?›?虫Ûk?Û⁄i
{
if(k==1)t=t+1;
for(;i<=k;i++)
{
if(k%i==0)mini(k/i,i);
}
return 0;
}
int main()
{
int N,n;
scanf("%d",&N);
for(n=0;n<=N-1;n++)
{
int M;
scanf("%d",&M);
mini(M,2);
printf("%d\n",t);
t=0;
}
}
|
1 | 34 | int total=0;
int divide(int k,int number)
{
if(number==1){total++;return 0;}
int i;
for(i=k;i<=number;i++)
{
if(number%i==0)
divide(i,number/i);
}return 0;
}
int main()
{
int i,n;
cin>>n;
int num[n];
for(i=0;i<n;i++)
cin>>num[i];
for(i=0;i<n;i++)
{total=0;
divide(2,num[i]);
cout<<total<<endl;
}
cin>>n;
return 0;
}
|
1 | 35 | 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=result+factor(n/i,i);
}
}
return result;
}
int main(){
int n,a[100000],b[100000];
scanf("%d",&n);
for(int j=0;j<=n-1;j++){
scanf("%d",&a[j]);
b[j]=factor(a[j],2);
printf("%d\n",b[j]);
}
return 0;}
|
1 | 36 | int n,m;
int sum(int x,int y)
{
int c,i;
if(x>sqrt(y))
c=0;
else
{
if(y%x==0)
{
for(i=x,c=1;i<=(y/2)+1;i++)
{
if((y/x)%i==0)
c=c+sum(i,(y/x));
}
}
else
c=0;
}
return(c);
}
main()
{
int i,k,j;
scanf("%d",&n);
for(j=1;j<=n;j++)
{
k=0;
scanf("%d",&m);
for(i=2;i<=(m/2)+1;i++)
k=k+sum(i,m);
printf("%d\n",k+1);
}
}
|
1 | 37 |
int fact(int a, int min)
{
if (a<min)
return 0;
int way = 1;
for (int i = min; i <= sqrt((double)a); i++)
if (a%i == 0)
way += fact(a / i, i);
return way;
}
int main()
{
int n;
cin >> n;
for (int i = 0; i<n; i++)
{
int c;
cin >> c;
cout << fact(c, 2) << endl;
}
return 0;
}
|
1 | 38 | //n???????i?????????
int divi(int n,int i)
{
int num=0;
if(n%i==0)
{
if(n==i) //?????????????????1
{
return 1;
}
for(int j=2;j<=i;j++)
{
num=num+divi(n/i,j); //??
}
return num;
}
else
{
return 0;
}
}
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+divi(n,j);
}
cout<<sum+1<<endl;
}
return 0;
}
|
1 | 39 | int s=0,z=2;//?????? z?? ???????
void number(int x,int y)
{ //????
int i;
if(x==1)
{
s=s+1;
}//????1? ???? s+1
for(i=y;i<=x;i++)
{
if(x%i==0)
{
number(x/i , i);
}//??????
}
}
int main()
{
int n,a,i;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>a;
number(a,z);
cout<<s<<endl;//????
s=0;//S?0
}
}
|
1 | 40 | int t;
void tot(int,int);
int main()
{
int n,a[100],i;
cin>>n;
for(i=1;i<=n;i++)
cin>>a[i];
for(i=1;i<=n;i++) {
t = 0;
tot(a[i],2);
cout<<t<<endl;
}
return 0;
}
void tot(int x, int min)
{ int k;
if(x==1) {
++t;
return;
}
for(k=min;k<=x;k++)
if(x%k==0)
{
tot(x/k, k);
}
} |
1 | 41 | int num=0;
int solution(int a,int b){
for(int i = b; i <= a; i++){
if(a%i == 0){
a=a/i;
if(a == 1) num++;
else num=solution(a,i);
a=a*i;
}
}
return num;
}
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
int a;
cin>>a;
num=0;
cout<<solution(a,2)<<endl;
}
return 0;
}
|
1 | 42 | int sum=0;
void recur(int N,int i)
{
if(N==1) sum++;
while(i<=N)
{
if(N%i==0)
recur(N/i,i);
i++;
}
return ;
}
int main()
{
int t=0;
cin>>t;
for(int k = 0; k < t; k++)
{
int n=0;
cin>>n;
int i=2,res=1;
for(int i =2; i <=n/2;i++)
{
if(n%i==0)
{
sum=0;
recur(n/i,i);
res+=sum;
}
}
cout<<res<<endl;
}
return 0;
}
|
1 | 43 | int ans = 0;
void work(int p,int k)
{
if(p == 1){
ans ++;
return ;
}
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 | 44 | /*************************************************************************************************************
* @file .cpp
* @author ????
* @date
* @description
* ????
*/
int i;
int fenjie( int x, int t)
{
int j;
if(x == 1 || x == 2)
return 1;
int s = 1;
for (j = t; j <= sqrt(x); j++)
{
if (x % j == 0)
s += fenjie((x / j), j);
}
return s;
}
int main()
{
int n, a[100],x,t;
cin >> n;
for (i = 0; i < n; i++)
{
cin >> x;
a[i] = fenjie(x,2);
}
for(i = 0; i < n; i++)
cout << a[i] << endl;
return 0;
} |
1 | 45 | /*
* main.cpp
*
* Created on: 2012-11-12
* Author: ??
* 1090 ????
*/
int sum;
int a[100];
void search(int t,int k)
{
int i;
if (k==1) sum++;
else
for (i=a[t-1];i<=k;i++)
if (k%i==0) {a[t]=i;search(t+1,k/i);}
}
int main()
{
int n,i,k;
cin>>n;
for (i=1;i<=n;i++)
{
cin>>k;
sum=0;
a[0]=2;
search(1,k);
cout<<sum<<endl;
}
return 0;
}
|
1 | 46 | int f(int a,int j);
int main()
{
int n,a,s,i;
cin>>n;
for(i=0;i<n;i++)
{
cin>>a;
s=f(a,2)+1;
cout<<s<<endl;}
return 0;
}
int f(int a,int j)
{ int i,tem;
//if(j>sqrt(a))return 0;
int count = 0;
for(i=j;i<=sqrt(a);i++)
{
if(a%i==0)
{
j=i;
//tem=f(a/i,j);
//count=(tem+1)+count;
//cout<<"i="<<i<<","<<"f="<<tem<<","<<count<<endl;
//cout<<"count="<<count<<endl;
//count=(f(a/i,j)+1)+count;
//count=count+(f(a/i,j)+1);
if(a/i < j) count+=1;
else count+=(f(a/i,j)+1);
//cout<<"i="<<i<<","<<count<<endl;
}
}
return count;
} |
1 | 47 | int n, a, cnt = 0, num;
int decompose(int x, int y)
{
int i, xnum = 1;
if(x == 1)
return 0;
if(x == 2)
return 1;
for(i = y; i <= (int)sqrt(x); i++)
if(x % i == 0)
xnum += decompose(x / i, i);
return xnum;
}
int main()
{
cin >> n;
while(cnt < n)
{
cin >> a;
num = decompose(a, 2);
cout << num << endl;
cnt++;
}
return 0;
}
|
1 | 48 | int disassamble(int, int);
int main()
{
int n;
int i = 1;
int a, result;
cin >> n;
while(i <= n)
{
i++;
cin >> a;
result = disassamble(a, 2);
cout << result << endl;
}
return 0;
}
int disassamble(int a, int y)
{
int i, count = 1;
if(a == 1)
return 0;
if(a == 2)
return 1;
for(i = y; i * i <= a; i++)
{
if(a % i == 0)
{
count = disassamble(a / i, i) + count;
}
}
return count;
} |
1 | 49 | int multiply(int a,int b)
{
int i=0,n=0,sum=1;
if(a<b)
return 0;
else
{
for(i=b;i<=a;i++) //????
{
if(a%i==0)
{
sum=sum+multiply(a/i,i); //????
}
}
return sum;
}
}
int main()
{
int n=0,m=0,i=0,sum=0,num,result[1000];
cin>>n;
do //?????
{
cin>>num;
result[i]=multiply(num,2); //????
i=i+1;
m=m+1;
}while(m<n);
for(i=0;i<n;i++)//????
{
cout<<result[i]<<endl;
}
return 0;
}
|
1 | 50 | //????
//2010?12?03?
//1000012753 ???
int deal(int num, int p)
{
int i, sum = 0;
if(num == 1)
return 1;
for(i = p; i <= num; ++i)
if(num % i == 0)
sum += deal(num / i, i);
return sum;
}
int main()
{
int n, a;
cin >> n;
while(n--)
{
cin >> a;
cout << deal(a, 2) << endl;
}
return 0;
}
|
1 | 51 | /*
* 11.27.cpp
*
* Created on: 2011-11-27
* Author: Administrator
*/
int coun; // ???????
void depart(int n,int i)
{
int j;
if (n==1) coun++ ;
else for (j=i;j<=n;j++) //???j?? ??????
if (n%j==0) {depart(n/j,j);}
}
int main (){
int n,j;
cin>>n;
int b[n]; //???????
for(j=0;j<n;j++)
cin>>b[j];
for(j=0;j<n;j++)
{
coun=0; //?????
depart(b[j],2);
cout<<coun<<endl;
}
return 0;
}
|
1 | 52 | /*
* seperateThenumber.cpp
*
* Created on: 2012-11-13
* Author: AK
*/
int sum=1; //??????sum ??f???sum?????
void f(int begin,int m){ //??f??
int i;
for(i=begin;i<=m;i++){ //?i???????????
if(m%i==0&&m/i>=i){sum++;f(i,m/i);} //????????????????? ????????????
if(i>m/i) break; //?????????????break
}
}
int main(){
int n,j,m;
cin>>n; //????????n
for(j=1;j<=n;j++){ //???????
cin>>m;
f(2,m);
cout<<sum<<endl; //??sum?
sum=1; //??sum=1
}
return 0;
}
|
1 | 53 | int main()
{
int i,n;
int fun(int n,int begin);
scanf("%d",&i);
while (i-->0)
{
scanf("%d",&n);
printf("%d\n",fun(n,2));
}
return 0;
}
int fun(int n,int begin)
{
int i,result=1;
for (i=begin;i<=sqrt(n);i++)
if (n%i==0)
result+=fun(n/i,i);
return result;
} |
1 | 54 | //********************************
//*????
//********************************
int f(int a, int b)
{
if (a == 1)
return 1;
else
{
int c,d,i;
c = 0;
d = (int)sqrt((double)a);
for (i = b; i <= a; i ++)
{
if (!(a % i))
c+= f(a / i,i);
}
return c;
}
}
int main()
{
int n,a,i;
cin >> n;
for (i = 0; i < n; i++)
{
cin >> a;
cout << f(a,2) << endl;
}
cin.get();
cin.get(); //????
return 0;
}
|
1 | 55 |
//????????????????????????????
//?a??????????min???
//?????????????
int F(int min,int a)
{
int i;
int sum=0;
if(min==a) //????????
return 1;
if(a==1)
return 1; //???????
for(i=min;i<=a;i++)
{
if(a%i==0)
sum+=F(i,a/i); //??????????
}
return sum; //???
}
int main()
{
int a,n;
int i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a);
printf("%d\n",F(2,a));
}
return 0;
} |
1 | 56 | void TRY(int,int);
int num=1;
int main()
{
unsigned short int n;
int INTEGER;
cin>>n;
while(n-->0)
{
cin>>INTEGER;
int h=2;
TRY(h,INTEGER);
cout<<num<<endl;
num=1;
}
}
void TRY(int a,int b)
{
int i;
for(i=a;i<=sqrt(b);i++)
{
if((b%i==0)&&(b/i!=1))
{
num++;
TRY(i,b/i);
}
}
} |
1 | 57 | /**
*???4.cpp
*??????
*???????
*???12?1?
*/
int num,s=1; //??num??????s???????
void divide(int n,int a) //?????n????a??????
{
for(int i=n;i<=a/s;i++)//??
{
s*=i;
if(s==a) //???????a???????+1
num++;
else if(s<a && a%s==0) //??????a,??????????
divide(i,a);
s/=i; //????
}
}
int main() //???
{
int n,i,a;
cin>>n; //????????
for(i=0;i<n;i++)
{
num=0; //????????0
cin>>a; //??????
divide(2,a); //??????
cout<<num<<endl;
}
return 0;
} |
1 | 58 |
int p(int a,int m)
{
int t=0;
int i;
if(a%m!=0)
return 0;
if((a%m==0)&&(a/m<m)&&(a!=m))
return 0;
if(a==m)
return 1;
if((a%m==0)&&(a/m>=m))
{
for(i=m;i<=a/m;i++)
{t=t+p(a/m,i);}
return t;
}
}
int main()
{ int n;
cin>>n;
int i;
int x;
int j;
int num=0;
for(i=0;i<n;i++)
{
cin>>x;
for(j=2;j<=x;j++)
{
num=num+p(x,j);
}
cout<<num<<endl;
num=0;
}
return 0;
}
|
1 | 59 | int de(int s,int a){ //???????a???????s?????????
int sum=0; //?????????????
if(a==1)return 1; //a?????????????????
else if(s>a)return 0; //a?????????????????????
for(int i=s;i<=a;i++) //for????a??????????
if(a%i==0)sum=sum+de(i,a/i); //?????????????????????
return sum; //??????
}
int main(){ //???
int n; //??????n????????
cin>>n; //??n??
while(n>0){ //while??????????
int a; //??????a
cin>>a; //??a??
cout<<de(2,a)<<endl; //???a???????2??????????
n--; //n???
}
return 0; //?????????????????
} |
1 | 60 | int f(int a,int b)
{
int c,s=0,i;
c=(int)sqrt(a);
for(i=b;i<=c;i++)
{
if(a%i==0)
s=s+f(a/i,i);
}
return s+1;
}
main()
{
int n,i;
scanf("%d",&n);
int num[1000];
for(i=0;i<n;i++)
{
scanf("%d",&num[i]);
printf("%d\n",f(num[i],2));
}
} |
1 | 61 | int begin=2;
int main()
{
int f(int);
int n=0,x=0,i=0;
cin>>n;
for(i=0;i<n;i++)
{
cin>>x;
cout<<f(x)+1<<endl;
}
return 0;
}
int f(int x)
{
int i=0;
int left=0;
int num=0;
for(i=begin;i<=sqrt(x);i++)
{
if(x%i==0)
{
num++;
left=x/i;
begin=i;
num+=f(left);
}
}
//if(num!=0)
begin=2;
return num;
//else
//return 0;
}
|
1 | 62 | int w=1;
int f(int x)
{
int z=1,y,v=0;
for(y=w+1;y<=sqrt(x);y++)
{
if(x%y==0)
{
z=z+f(x/y);
v++;
w=y;
}
}
if(v==0)
z=1;
return z;
}
main()
{
int n,u=0,a;
scanf("%d",&n);
do
{
scanf("%d",&a);
printf("%d\n",f(a));
u++;
w=1;
}
while(u!=n);
}
|
1 | 63 | //============================================================================
// Name : hanshu0109.cpp
// Author : 1300012911
// Version : 20131120,Wed,11th week
// Copyright :
// Description : ????
//============================================================================
int fenjie(int a,int max){//a:?????max??1??????????????
int i = 0;
int sum = 0;//????
if (a == 1) return 1;//1???????1??????
for (i = max;i >= 2;i--)
{
if ((a % i) == 0) sum += fenjie(a/i,i);//i??????
}
return sum;//????
}
int main() {
int k = 0;
int n = 0;
int num = 0;
cin >> n;//??
for (k = 1;k <= n;k++)
{
cin >> num;//?????
cout << fenjie(num,num);//????????
if (k < n) cout << endl;
}
return 0;
}
|
1 | 64 | int a[1000];
int l=0,x;
int fff(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(q-1,1,x);
printf("%d\n",l,x);
}
}
int fff(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(w,i,x);
x=x*a[i];
}
}
}
|
1 | 65 | int fenjie(int x,int y){//x????? y??????????
int i,s=0;//s??????
if(x==y)return 1;
for(i=y;i<x;i++)
if(x%i==0)s+=fenjie(x/i,i);
if(i==x)s++;
return s;
}
int main(){
int n,i;//n???????
cin>>n;
for(;n>0;n--){
cin>>i;
cout<<fenjie(i,2)<<endl;
}
return 0;
} |
1 | 66 | int factoring(int a,int b)
{
int i,kind=0;
if(a==1)
{
kind=1;
}
else
{
for(i=b;i<=a;i++)
{
if(a%i==0)
{
kind=factoring(a/i,i)+kind;
}
}
}
return kind;
}
int main()
{
int n,i,j,a[30000]={0},b[30000]={0};
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
b[i]=factoring(a[i],2);
}
for(i=0;i<n;i++)
{
printf("%d\n",b[i]);
}
return 0;
} |
1 | 67 | //**********************************************
//**???1090 ????*************************
//**?????? 1000012741*********************
//**???2010?12?7?*************************
//**********************************************
//??change???a???????p???????
int change (int a, int p)
{
int i, count = 0; //count??????????
for (i = p; i < a; i++)
{
if (a % i == 0 && a / i >= i) //??????????????
{
count++; //???1
int k, t;
k = (int) sqrt(a / i); //?k?a/i????
for (t = 2; t <= k; t++)
{
if ((a / i) % t == 0) //??a???2?k??????
{
count += change (a / i, i); //?a/i??????
break;
}
}
}
}
return count; //??count?
}
int main()
{
int n, i, a; //n?????????a?????
cin >> n;
for (i = 1; i <= n; i++)
{
int total = 0; //total?????
cin >> a;
total += change (a, 2); //??change??
cout << total + 1 << endl; //??1?????????????
}
return 0;
}
//********************************************** |
1 | 68 |
int factoring(int a,int b)
{
int i,kind=0;
//printf("ok a=%d b=%d\n",a,b);
if(a==1)
{
kind=1;
//printf("kind=1 ok\n");
}
else
{
for(i=b;i<=a;i++)
{
// printf("ok\n");
if(a%i==0)
{
kind=factoring(a/i,i)+kind;
//printf("ok %d\n",kind);
}
}
}
return kind;
}
int main()
{
int n,x[40000],i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&x[i]);
}
for(i=0;i<n;i++)
{
x[i]=factoring(x[i],2);
printf("%d\n",x[i]);
}
return 0;
} |
1 | 69 | /*
* 009.cpp
*
* Created on: 2012-11-27
* Author: asus
*/
int varieties = 0;//??????
void divide(int forward, int number)//??divide??
{
int i;
if (number == 1)//????
{
varieties++;//??
}
for (i = forward; i <= number; i++)//forward???????,number?????,?forward?????
{
if (number % i == 0)//????
{
divide(i, number / i);
}}}
int main()//???
{
int n = 0, num = 0;
cin >> n;//????
for (int i = 1; i <= n; i ++)
{cin >> num;
divide(2, num);//??
cout << varieties << endl;
varieties = 0;
}
return 0;
} |
1 | 70 |
int num=0;
void asd (int i,int q)
{
int j;
for(j=q;j>1;j--)
{
if(i%j!=0)
continue;
if(i==j)
{
num++;
}
else
{
q=j;
asd(i/j,q);
}
}
}
int main()
{
int n,o;
cin>>n;
for(o=0;o<n;o++)
{
num=0;
int a;
cin>>a;
asd(a,a);
if(num==1)
cout<<1<<endl;
else
cout<<num<<endl;
}
} |
1 | 71 | int s=0;
void devide(int,int);
int main()
{
int n,m;
cin>>n;
while(n--)
{
cin>>m;
s=0;
devide(2,m);
cout<<s+1<<endl;
}
return 0;
}
void devide(int a,int b)
{
int i;
for(i=a;i<=sqrt(b);i++)
{
if(b%i==0)
{
s++;
devide(i,b/i);
}
}
}
|
1 | 72 | int f(int x,int y) //???????????????y?????????x????????
{
int i,sum = 0;
for(i = x; i <= sqrt(y); i++){
if(y % i == 0) sum += f(i,y / i) + 1;} //??????
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 | 73 | int f(int m,int n)//?????
{
if(m<n||m/n==1)//?????????2?????0
return 0;
if((m%n==0)&&m/n>=n)//?m???n??m/n?????n
return f(m/n,n)+f(m,n+1)+1;
else//??????
return f(m,n+1);
}
int main()
{
int q,i;
cin>>q;
for(i=1;i<=q;i++)
{
int p;
cin>>p;
cout<<f(p,2)+1<<endl;//?1?????????????
}
return 0;//????
}
|
1 | 74 | int shi(int a)
{
int b=sqrt(a);
for(int i=2;i<=b;i++)
{
if(a%i==0)return 0;
}
return 1;
}
int shu(int m,int k)
{
int a=1;
for(int j=k;j<=sqrt(m);j++)
{
if(m%j==0&&m/j>=k)
{
a++;
if(shi(m/j)==0)a+=shu(m/j,j)-1;
}
}
return a;
}
int main()
{
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
int m,a;
scanf("%d",&m);
printf("%d\n",shu(m,2));
}
return 0;
} |
1 | 75 | /*???2011?11?28?
*??????
*????division.cpp
*????? - 1090 ????
*/
int main()
{
int n = 0, integer = 0; //???????????n?????plate????apple
int division(int, int); //????putapple??????????plate?????
//apple???????????
cin >> n; //??????n
for (int i = 0; i < n; i++)
{
cin >> integer;
cout << division(integer, integer) << endl; //??????????putapple????????
}
return 0;
}
int division(int integer, int limit)
{
if (limit <= 1)
return 0;
switch(integer)
{
case 1:
return 1;
break;
default:
{
int sum = 0;
for (int a = 1; a <= integer; a++)
{
if (integer%a != 0)
continue;
else if (integer/a > limit)
continue;
else
sum += division(a, integer/a);
}
return sum;
}
break;
}
}
|
1 | 76 | /*
*???: ????.cpp
*??????
*????: 2012-11-12
*??: ????????????
*/
int count(int num, int m)
//???????????????????a1????????????
{
if (num % m != 0) return 0;
if (num == m) return 1;
else {
int counter = 0;
for (int i = m; i <= num / m; i++){
counter += count(num / m, i);
}
return counter;
}
}
int main ()
{
int n,num;
cin >>n;
for (int i = 1; i <= n; i++){
int counter = 0;
cin >> num;
for (int i = 2; i <= num; i++)
counter += count(num,i);//a1???2???m???
cout << counter << endl;
}
return 0;
} |
1 | 77 |
int sum[50];
int i;
int main()
{
void digui(int x, int y);
int n;
int j[50],m[50];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&m[i]);
sum[i]=0;
for (j[i]=2;j[i]*j[i]<=m[i];j[i]++)
{
if(m[i]%j[i]==0)
{
sum[i]++;
digui(j[i],m[i]/j[i]);
}
}
printf("%d\n",sum[i]+1);
}
return 0;
}
void digui(int x, int y)
{
int s;
for(s=x; s*s<=y; s++)
{
if(y%s==0)
{
sum[i]++;
digui(s,y/s);
}
}
}
|
1 | 78 | int num=0;
void f(int x,int y)
{
num++;
for(int j=y;j*j<=x;j++)
{
if(x%j==0)
f(x/j,j);
}
}
int main()
{
int n;
cin>>n;
int a[1100];
for(int i=1;i<=n;i++)
{
num=0;
cin>>a[i];
f(a[i],2);
cout<<num<<endl;
}
return 0;
}
|
1 | 79 |
int n;
int next(int a,int b)
{
if(a==1)
return 1;
if(a<b)
return 0;
int sum=0;
for(;b<=a;b=b+1)
if(a%b==0)
sum=sum+next(a/b,b);
return sum;
}
int main()
{
int i,m;
cin>>m;
for(i=0;i<m;i=i+1)
{
cin>>n;
cout<<next(n,2)<<endl;
}
return 0;
}
|
1 | 80 | //??????sum??????????temp??????
int sum ,temp ;
void fact(int) ;//??fact????int?????
int main ()
{
int n , i , k ;
cin >> n ;
for ( i = 0 ; i < n ; i++ )
{
cin >> k ;
sum = 0 ;
temp = 2 ;//????????????????????????
fact(k) ;
cout << sum << endl ;
}
return 0 ;
}
void fact(int k)
{
if ( k == 1 )//???????
{
sum++ ;
return ;
}
int i ;//i?????k???????temp??????????????????????????
for ( i = temp ; i <= k ; i++ )
{
if ( k % i == 0 )
{
temp = i ;//??temp?
fact(k/i) ;//???????
}
}
} |
1 | 81 | void Factorize(int n, int fact);
int number = 0;
int main()
{
int times, num, i;
cin >> times;
for (i = 0; i < times; i++)
{
cin >> num;
Factorize(num, 2);
cout << number << endl;
number = 0;
}
return 0;
}
void Factorize(int n, int fact)
{
int i;
for (i = fact; i <= sqrt(n); i++)
{
if (n % i == 0)
Factorize(n / i, i);
}
number++;
}
|
1 | 82 | int count;
void fun(int m,int n)
{ if(m <=sqrt(n)){
for (int a=m;a <=sqrt(n);a++)
{
if(n%a==0){
count ++; fun (a,n/a);}
else count=count;
}}
else count=count;
}
main()
{
int n;scanf("%d",&n);
for (int i =0;i<n;i++)
{
count=0;
int num;scanf("%d",&num);
for(int j=2;j<=sqrt(num);j++)
{
if(num%j==0)
{count ++; fun(j,num/j);}
}
printf ("%d\n",count+1);
}} |
1 | 83 | /*
* fenjie.cpp
*
* Created on: 2010-11-28
* Author: ???
* function: ????
*/
int solutionNumber(int a,int k){//??????????????
int i;
if(a==1) return 1;
if(k>a) return 0;
for(i=k;i<=a;i++)
if(a%i==0) return solutionNumber(a,i+1)+solutionNumber(a/i,i);
}
int main()
{
int n,a[101];
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];//??????
cout<<solutionNumber(a[i],2)<<endl;//????????????
}
return 0;
}
|
1 | 84 | int a,n,sum=0;
void t(int m)
{
int i,j;
for(i=m;i<=a;i++)
{
if(a%i==0)
{
a=a/i;
if(a==1)
{
sum+=1;
}
else t(i);
a=a*i;
}
}
}
int main()
{
int k;
cin >> n;
for(k=0;k<n;k++)
{
sum=0;
cin >> a;
t(2);
cout << sum << endl;
}
return 0;
} |
1 | 85 | /*
* e.cpp
* ?????
* ????: 2010-12-8
* ???????
*/
int find_factor(int a,int b)
{
int i,sum=0;
if(a==1) return 1;
for(i=b;i<=a;i++)
if(a%i==0)
sum=sum+find_factor(a/i,i);
return sum;
}
int main(void)
{
int n;
cin>>n;
int a;
for(int i=1;i<=n;i++)
{
cin>>a;
cout<<find_factor(a,2)<<endl;
}
return 0;
} |
1 | 86 | //???????a?????????????????a = a1 * a2 * a3 * ... * an???1 < a1 <= a2 <= a3 <= ... <= an?????????????????a = a???????
//Goofy 2010 12 05
void FenJie(int);
int counter=0;
int Befor=0;
int main()
{
int n, x, i;
cin>>n;
for(i=0; i<n; i++)
{
cin>>x;
counter=0;
Befor=x;
FenJie(x);
cout<<counter<<endl;
}
return 0;
}
void FenJie(int x)
{
int i, temp=Befor;//?????????
if (x==1)
{
counter++;
return;
}
for(i=Befor; i>1; i--)//??????
{
if (x%i==0)
{
Befor=i;
FenJie(x/i);
}
Befor=temp;
}
return;
}
|
1 | 87 | int ispr(int t)
{
int v=sqrt(t*1.0)+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);
while(n--) {
int a;
scanf("%d",&a);
if(ispr(a)) {
printf("1\n");
continue;
}
int i=2,res=1;
while(i<=a/2) {
if(a%i==0) {
sum=0;
fun(a/i,i);
res+=sum;
}
i++;
}
printf("%d\n",res);
}
} |
1 | 88 | 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;
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 | 89 | int factor(int N,int min);
int main()
{
int m,n,i,k;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&m);
k=factor(m,2);
printf("%d\n",k);
}
return 0;
}
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;
}
|
1 | 90 | int Divide(int a,int b);
int main()
{
int Times=0;
int Num=0;
int i=0;
int Temp[100]={0};
cin>>Times;
for (i=0;i<Times;i++)
{ cin>>Num;
Temp[i]=Divide(Num,Num);
}
for (i=0;i<Times;i++)
{cout<<Temp[i]<<endl;}
return 0;
}
int Divide(int a,int b)
{
int Sum=0;
int i=0;
int Flag=0;
if (a!=1)
{ for (i=b;i>1;i--)
{if (a%i==0)
Sum+=Divide(a/i,i);
Flag=1;
}
}
if (Flag==0||a==1)
{Sum=1;}
return Sum;
}
|
1 | 91 | int factor(int,int);
int main()
{
int n,num;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>num;
cout<<factor(num,2)<<endl;
}
return 0;
}
int factor(int n,int min)
{
int i;
int num=1;
if(n<min)
return 0;
else
{
for(i=min;i<n;i++)
{
if(n%i==0)
num+=factor(n/i,i);
}
}
return num;
} |
1 | 92 |
int is_bottom,max;
int div_foo(int n,int min);
int main(){
int N;
cin>>N;
for(int index=0;index<N;index++){
int k;
cin>>k;
is_bottom=0;
cout<<div_foo(k,2)+1<<endl;
}
return 0;
}
int div_foo(int n,int min){
int cal=0;
for(int iter=min;iter<=sqrt(n);iter++){
if(!(n%iter)){
cal++;
int f1=n/iter,f2=iter,g;
g=div_foo(f1,f2);
cal+=g;
}
}
return cal;
}
|
1 | 93 | //*********************************
//* file?1.cpp
//* description: ????
//* author: ?? 1200012858
//* date: 2012-12-1
//*********************************
int decompose(int x, int y);
int main ()
{
int n, m;
cin >> n;
for (int j = 1; j <= n; j++)
{
cin >> m;
cout << decompose(m, 2) << endl;
}
return 0;
}
int decompose(int x, int y)
{
int sum = 1,b;
b = (int)sqrt(x);
if (x == 1) return 0;
for (int i = y; i <= b; i++)
{
if (x % i == 0)
{
sum = sum + decompose(x / i, i);
}
}
return sum;
}
|
1 | 94 | int sum;
void zhongshu(int qian,int a);
int main()
{
int n,i,j,a[100];
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
for(i=0;i<n;i++)
{ sum=0;
zhongshu(2,a[i]);
cout<<sum<<endl;
}
return 0;
}
void zhongshu(int qian,int a)
{
int i,j,c;
if(a==1)
{
sum=sum+1;
return;
}
for(i=qian;i<=a;i++)
{
if(a%i==0)
zhongshu(i,a/i);
}
} |
1 | 95 | int sum=0,g,f;
int divide (int chushu,int a)
{
int i;
for (i=chushu;i<=a;i++)
{
if (a%i==0)
{
f=a/i;
if (f>1)
{g=i;divide (g,f);}
else
{
sum++;
}
}
} return sum;
}
int main()
{
int n=0;
cin>>n;
int p=0;
for (p=0;p<n;p++)
{
int b=0,c=2;
cin>>b;
sum=0;
cout<<divide (c,b)<<endl;
}
return 0;
} |
1 | 96 | int number=0;
int l;
void sort (int n)
{
int i;
for (i=l;n/i>=i;i++)
{
if (n%i==0)
{
l=i;
sort (n/i);
if (n/i==1)
number++;
}
}
number++;
}
int main ()
{
int n,m,k;
cin >> n;
for (k=0;k<n;k++)
{
l=2;
number=0;
cin >> m;
sort (m);
cout << number << endl;
}
return 0;
}
|
1 | 97 | //******************************************************************************
//??? ?????????????? *
//????wayne *
//?????11.23 *
//******************************************************************************
int sum=1,j=2; //?????????????????
void num(int); //??????
int main() //?????
{
int n,a[100];
int i;
cin>>n;
for (i=1;i<=n;i++) //????n?????
{
cin>>a[i];
num(a[i]); //????
cout<<sum<<endl;
sum=1,j=2; //????????????????
}
return 0;
}
void num(int a) //????
{
int k;
for (k=j;k<=sqrt(a);k++) //k=j?????????????????
{
if (a%k==0) //???????
{
sum=sum+1; //?????
j=k; //???????
num(a/k); //????
}
}
} |
1 | 98 | int a;
int res;
int sum;
void dfs(int cnt){
if(cnt*sum==a){res++; return;}
if(cnt*sum<a){
sum*=cnt;
int j=a/sum;
for(int i=cnt;i<=j;i++)
dfs(i);
sum/=cnt;
return;
}
}
int main(){
int nCases;
scanf("%d",&nCases);
for(int i=0;i<nCases;i++){
scanf("%d",&a);
res=0; sum=1;
for(int i=2;i<=a;i++) dfs(i);
printf("%d\n",res);
}
return 0;
} |
1 | 99 | int s(int n,int m){
if (n==1)return 1;
int an=0;
for (int i=m;i>1;i--){
if (n%i==0)an+=s(n/i,min(i,n/i));
}
return an;
}
int main(){
int N;
cin>>N;
int x;
for (N;N>0;N--){
cin>>x;
cout<<s(x,x)<<endl;
}
return 0;
} |
End of preview. Expand
in Dataset Viewer.
Dataset is imported from CodeXGLUE and pre-processed using their script.
Where to find in Semeru:
The dataset can be found at /nfs/semeru/semeru_datasets/code_xglue/code-to-code/Clone-detection-POJ-104 in Semeru
CodeXGLUE -- Clone Detection (POJ-104)
Task Definition
Given a code and a collection of candidates as the input, the task is to return Top K codes with the same semantic. Models are evaluated by MAP@R score. MAP@R is defined as the mean of average precision scores, each of which is evaluated for retrieving R most similar samples given a query. For a code (query), R is the number of other codes in the same class, i.e. R=499 in this dataset.
Dataset
We use POJ-104 dataset on this task.
Data Format
For each file, each line in the uncompressed file represents one function. One row is illustrated below.
- code: the source code
- label: the number of problem that the source code solves
- index: the index of example
Data Statistics
Data statistics of the dataset are shown in the below table:
#Problems | #Examples | |
---|---|---|
Train | 64 | 32,000 |
Dev | 16 | 8,000 |
Test | 24 | 12,000 |
Reference
@inproceedings{mou2016convolutional,
title={Convolutional neural networks over tree structures for programming language processing},
author={Mou, Lili and Li, Ge and Zhang, Lu and Wang, Tao and Jin, Zhi},
booktitle={Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence},
pages={1287--1293},
year={2016}
}
- Downloads last month
- 54