id
int32
0
32.5k
code
stringlengths
95
8.4k
label
stringclasses
65 values
0
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
1
/* * 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
2
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
3
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
4
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
5
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
6
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
7
int ans = 0; int work(int p,int k) { if (p==1) {ans++; return (p*k,k);} for(int i =k;i <= p;i ++){ if(p % i == 0){ work(p / i,i); } } } int main() { int n; scanf("%d",&n); while(n--){ ans = 0; int t; scanf("%d",&t); work(t,2); //ans = work(t); printf("%d\n",ans); } return 0; }
1
8
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
9
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
10
//???? //????? int ana(int n,int p) { int i; int t,s=1; t=pow(n,0.5); for(i=p;i<=t;i++) if(n%i==0) s=s+ana(n/i,i);//?? return s; } //??? int main() { int n; int a[100]; int i; cin>>n; for(i=0;i<n;i++) cin>>a[i]; for(i=0;i<n;i++) cout<<ana(a[i],2)<<endl;//???? return 0; }
1
11
int f(int n,int m) { int sum=1,i; if(n<m) sum=0; else if(n==m) sum=1; else { for(i=m;i<=n;i++) if(n%i==0) sum=sum+f(n/i,i); } return(sum); } void main() { int x,j,a[100000]; scanf("%d",&x); for(j=0;j<x;j++) scanf("%d",&a[j]); for(j=0;j<x;j++) printf("%d\n",f(a[j],2)); }
1
12
int a[1000]; int l=0,x; int fff(int w,int t); int main() { int i,j,q,p,n,m,y; scanf("%d",&n); for(p=0;p<n;p++) {q=1;l=0; scanf("%d",&x); for(i=2;i<=x;i++) if(x%i==0) {a[q]=i; q++; } fff(q-1,1); printf("%d\n",l); } } int fff(int w,int t) { int i,j,y,n,m,p; for(i=t;i<=w;i++) {if(x%a[i]==0) {x=x/a[i]; if(x==1){l++;} if(x>1) fff(w,i); x=x*a[i]; } } }
1
13
int turn(int a,int b) { int i,k; if(a==1) k=1; else if(a<b) k=0; else { k=0; for(i=b;i<=a;i++) if(a%i==0) k=k+turn(a/i,i); } return k; } int main() { int n,i,a[1000],t; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); t=turn(a[i],2); printf("%d\n",t); } return 0; }
1
14
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
15
void fenjie(int, int, int); int g_num, g_count; int main() { int n, i; cin >> n; for(i = 1; i <= n; i++ ) { g_count = 0; cin >> g_num; fenjie(2, g_num, 1); cout << g_count << endl; } return 0; } void fenjie(int a, int num, int sum) { while( a <= g_num ) { sum *= a; if( sum == g_num ) g_count++; if( sum < g_num ) fenjie(a, g_num, sum); if( sum > g_num ) return; sum /= a; a++; } }
1
16
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
17
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
18
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
19
int prime(int n, int m ) { int i,total=1; if(n<m)return 0; for(i=m;i<=n;i++) { if(n%i==0) total+=prime(n/i,i); } return total; } void main() { int n,b[2000],b0,i; scanf("%d",&n); for(i=0;i<=n-1;i++) { scanf("%d",&b0); b[i]=prime(b0,2); } for(i=0;i<=n-2;i++) { printf("%d\n",b[i]); } printf("%d",b[n-1]); }
1
20
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
21
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
22
/* * 1.cpp * * Created on: 2010-12-1 * Author: hanzhe */ int min(int a,int b){ //???? if(a>b)return b; else return a; } int f(int n,int s){ //???????s?n??????? int k=0,i; if(n==1)return 1; else if(s==1)return 0; else if(s>n)return f(n,n); else {for(i=2;i<=s;i++) if(n%i==0)k=k+f(n/i,min(i,s)); return k; } } int main(){ //???? int n,m; cin>>n; while(n>0){ cin>>m; cout<<f(m,m)<<endl; //?? n--; } return 0; } //????
1
23
/* * 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
24
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
25
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
26
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
27
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
28
int main() { int n,a[100]; int i; int f(int x,int min); //f:??????? for(i=0;i<100;i++) a[i]=0; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); a[i]=f(a[i],2); } for(i=0;i<n;i++) { printf("%d\n",a[i]); } return 0; } int f(int x,int min) { int y=0; int i; if(x==1) y=1; else { for(i=min;i<=x;i++) { if(x%i==0) { y=y+f(x/i,i); } } } return y; }
1
29
/** * @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
30
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
31
int fenj(int x, int y) { int a=(x==1),i; for (i=y;i<=x;i++)//???2????????? if(x%i==0)a=a+fenj(x/i,i);//????????? return a; } int main(){ int k; cin>>k; int a[k]; for(int i=0;i<k;i++)cin>>a[i]; for(int i=0;i<k;i++)cout<<fenj(a[i],2)<<endl; return 0; }
1
32
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
33
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
34
//**********?????????********************* //**********???????************************* //**********?????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
35
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
36
int j; int discharge(int x,int y) { int a=1; for(int i=y;i<=(sqrt((double)x));i++) { if(x%i==0) { a=a+discharge(x/i,i); } } return a; } int main() { int n,x,r[100]; cin>>n; for(j=0;j<n;j++) { cin>>x; r[j]=discharge(x,2); } for(j=0;j<n-1;j++) { cout<<r[j]<<endl; } cout<<r[n-1]; return 0; }
1
37
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; }
1
38
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
39
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
40
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
41
int fun(int x,int y) { int i,sum=0; for(i=x;i*i<=y;i++) if(y%i==0) {sum++;sum+=fun(i,y/i);} return sum; } int main() { int n,i,sum; scanf("%d",&n); while(n>0) { n--; scanf("%d",&i);sum=1; sum+=fun(2,i); printf("%d\n",sum); } return 0; }
1
42
int number=0; int main() { void f(int first,int m); int n,i,num; cin>>n; for(i=0;i<n;i++) { cin>>num; f(2,num); cout<<number/2<<endl; number=0; } return 0; } void f(int first,int m) { int i; for(i=first;i<=m;i++) { if(m%i==0) { m=m/i; f(i,m); if(m!=1) m=m*i; } } if(m==1) number+=1; }
1
43
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
44
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
45
int f(int,int); //???? int main( ) //????? { //????? int n,i,a[50]; cin >>n; //?????? for(i=0;i<n;i++){ cin >>a[i]; //???? cout <<f(a[i],2) <<endl; //???? } return 0; //??????????????????? } //????? int f(int n,int p) //??????????????p????? { int sum=0,m; if(n<p) return 0; else{ for(m=p;m<=n;m++) if(n%m==0){ if(m<n) sum=sum+f(n/m,m); //n?????m??????n/m??????m??????? if(m==n) sum=sum+1; //n?????n??????1 } return sum; } }
1
46
int dp[40000][200]={0}; int main() { int n,i,N; int mm( int , int ); cin>>n; for(i=1;i<=n;i++) { cin>>N; cout<<mm(N,2)<<endl; // if(prime(N)) cout<<"haha"; } return 0; } int mm( int n, int i) { int sum=1; if(dp[n][i]>0) return dp[n][i]; for(int j=i; j<=sqrt(n);j++) { if(n%j==0) { sum += mm(n/j,j); } } dp[n][i]=sum; return sum; }
1
47
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
48
void factor(int,int); int result[9999]={0}; int j=0; int main() { int times,k=1; cin>>times; while(k<=times){ int num,ansf=0; cin>>num; factor(2,num); for(int i=0;i<9999;i++) if(result[i])ansf++; cout<<ansf<<endl; for(int i=0;i<9999;i++) result[i]=0; k++; } return 0; } void factor(int start,int num) { if(num==1) {result[j]=1;j++;} for(int i=start;i<=num;i++){ if(num%i==0) factor(i,num/i); } }
1
49
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
50
/* /??? 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
51
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
52
int ways(int, int); void main() { int ways(int a, int min); int n,b; scanf("%d",&n); while(n-->0) { scanf("%d",&b); printf("%d\n",ways(b,2)); } } int ways(int a, int min) { if(a<min) return 0; int sum=0, i; for(i=min;i<=sqrt(a*1.0);i++) { if(a%i == 0) sum = sum + ways(a/i, i); } return sum+1; }
1
53
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
54
int count; void solve(int num,int a,int m) { int i; if(num==1) { count++; return;} for(i=2;i<=num;i++) { if(i>=a&&(num%i)==0) solve(num/i,i,m+1); } } main() { int n,i; scanf("%d",&n); for(i=0;i<n;i++) { int num,a; count=0; scanf("%d",&num); solve(num,0,1); printf("%d\n",count);} }
1
55
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
56
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
57
//************************************* //* ????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
58
int Factor(int, int); int main() { int n, a, i; scanf("%d",&n); for (i = 1;i <= n;i++) { scanf("%d",&a); printf("%d\n",Factor(a, 2)); } return 0; } int Factor(int a,int p) { int i, j, z = 1; if (a < p) z = 0; else { for (i = p;i <= a;i++) { if (a % i == 0) { z += Factor(a / i, i); } } } return z; }
1
59
/* * ????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
60
int f(int x,int y) { if(y==x) return 1; if(y>x) return 0; if(x%y==0) return f(x,y+1)+f(x/y,y); else return f(x,y+1); } int main() { int n,x; cin>>n; int z,i; i=n; while(i>0) { i=i-1; cin>>x; z=f(x,2); cout<<z<<endl; } return 0; }
1
61
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
62
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
63
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
64
int f(int q,int x) { if(q<x) { int i,k,p,sum; k=0;sum=0;p=0; for(i=2;i<=x/2;i++) if(x%i==0) k=k+1; if(k==0) return 1; else { for(i=q;i<=sqrt(x);i++) if(x%i==0)sum=sum+f(i,x/i); return sum+1; p=0; sum=0; } } else { if(q==x) return 1; else return 0; } } int main() { int n,i,x,sum; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&x); sum=f(2,x); printf("%d\n",sum); } }
1
65
int f(int x,int y){//x??????y???????? if((int)pow(x,0.5)<y)return 1;//??x^0.5???y??1 int d=1; for(int i=y;i<=(int)pow(x,0.5);i++)//??i<=x^0.5,?????? if((x%i)==0) d+=f(x/i,i);//?? return d; } int main(){ int n,m; cin>>n;//?? for(int k=1;k<=n;k++){ cin>>m; cout<<f(m,2)<<endl;//???? } return 0; }
1
66
int num; int fjys(int n,int m,int i,int d,int ji[20]) { int a; for(a=i;a<m;a++) { if(n%a==0) { ji[d]=a; int chenji=1,k; for(k=0;k<=d;k++) chenji=chenji*ji[k]; if(chenji==m) { num++; break; } else fjys(n/a,m,a,d+1,ji); } } return num; } int main() { int m,n,j,result=0,ji[20]={0}; cin>>m; for(j=1;j<=m;j++) { num=0; cin>>n; result=fjys(n,n,2,0,ji); cout<<result+1<<endl; } return 0; }
1
67
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
68
/*???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
69
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
70
//???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
71
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
72
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
73
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; }
1
74
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
75
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
76
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
77
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
78
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
79
int su(int input)//????????? { int ju=1; for(int i=2;i<sqrt(input);i++) { if(input%i==0) ju=0; break; } return ju; } int fenjie(int input, int k)//k???????????input?????? { int ret=1;//re?????????????? for(int i=k;i<=sqrt(input);i++) { if(input%i==0) { if(su(input/i)==0);//???????????????????? { ret=fenjie(input/i,i)+ret; } } } return ret; } int main() { int input,num,sol; cin>>num; while(num--)//???? { cin>>input; cout<<fenjie(input,2)<<endl;//sol?????????? } return 0; }
1
80
int f(int t) { double v=sqrt(t)+1; for(int i=2; i<v; i++) if(t%i==0) return 0; return 1; } int sum=0; void fun(int n,int i) { if(n==1) sum++; while(i<=n) { if(n%i==0) fun(n/i,i); i++; } return ; } int main() { int n; scanf("%d",&n); for(int i=0;i<n;i++) { int a; scanf("%d",&a); if(f(a)>0) { printf("1\n"); continue; } int i=2,K=1; while(i<=a/2) { if(a%i==0) { sum=0; fun(a/i,i); K+=sum; } i++; } printf("%d\n",K); } }
1
81
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
82
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
83
/* *????? *???2010 - 12 - 07 *????????? ???? */ int num(int,int,int); int qufen(int); int power(int,int); int main() { int t; cin >> t; while(t >= 1) { int n,i,x,sum = 1; cin >> n; x = qufen(n); //qufen???????????????????? for(i = 2; i <= x; i++) sum = sum + num(n,i,2); //num?????????????i???????? cout << sum << endl; t--; } return 0; } int qufen(int n) { int j; for(j = 1; ; j++) { if(power(2,j) > n) { return j - 1; break; } } } int power(int a,int b) { int sum = 1,k; for(k = 1; k <= b; k++) //????????? sum = sum * a; return sum; } int num(int n,int g,int h) { if((g == 1)&&(n >= h)) //??????? return 1; int i,j = 0,count = 0,a[20000]; for(i = h; i < n; i++) //???????????? n ?? i ?? g ??????n / i????? g - 1? { //?n = i * ……?g?? ???? n / i = h * ……(g - 1 ???h??????i??? if(n % i == 0) { a[j] = i; j++; } } if(j == 0) //j == 0????????????????? return 0; else { for(i = 0; i < j; i++) count = count + num(n / a[i],g - 1,a[i]); return count; } }
1
84
int get(int n,int m)//??????????????????n??????m?????? { if(n==1)return 1;//??n?1???????????1??? while(m>=2)//?m????????????????????????????????????? { if(n%m==0)break; --m; } if(m==1)return 0;//??m?1?????????? return get(n/m,m)+get(n,m-1);//?????????????????????????????????????n/m?????????? } int main() { int t; cin>>t; for(int i=0;i<t;++i) { int n; cin>>n; cout<<get(n,n)<<endl; } return 0; }
1
85
//********************************* //* 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
86
/* * 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
87
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
88
int f(int x,int y) { int s=0,i; for(i=y;i>1;i--)//??????????? { if(x%i==0) s+=f(x/i,i);//i?x/i????????1 } if(x==1) return 1; return s; } int main() { int n,i,a[50]; cin>>n; for(i=1;i<=n;i++) cin>>a[i]; for(i=1;i<=n;i++) cout<<f(a[i],a[i])<<endl; return 0; }
1
89
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
90
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
91
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
92
int check(int n,int i) { for(i=2; i<=n/2;i++) if(n%i==0) break; return (i==n/2&&n!=4)?1:0; } int f(int n, int k) { if (check(n,2)==1 || k==n) return 1; else if(n<k) return 0; else { int h=0,i; for( i=k;i<=sqrt(n);i++) if(n%i==0) h+=f(n/i,i); return h+1; } } void main() { int n,h,i; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&h); printf("%d\n",f(h, 2)); } }
1
93
int prime(int n) { int i,judge=1; for(i=2;i<n;i++) { if(n%i==0) judge=0; } return judge; } int function(int number,int x) { int temp=0,i,result=0; if(!prime(number)) { for(i=x;i<=number;i++) if(number%i==0) { x=i; temp=number/i; result+=function(temp,x); } } else if((number>=x||number==1)&&prime(number)) result=1; return result; } int main() { int i,times,number; cin>>times; for(i=0;i<times;i++) { cin>>number; cout<<function(number,2)<<endl; } return 0; }
1
94
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
95
int main() { int nFactor(int n, int border); int n; cin >> n; for (; n >= 1; n--) { int a; cin >> a; cout << nFactor(a, a) << endl; } return 0; } int nFactor(int n, int border) { if (n == 1) return 1; else { int i, sum = 0; for (i = border; i >= 2; i --) { if (n % i == 0) sum += nFactor(n / i, i); } return sum; } }
1
96
/*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
97
int main() { int fj(int m,int min); int t,i,a[100]; cin>>t; for(i=1;i<=t;i++) { cin>>a[i]; cout<<fj(a[i],2)<<endl; } return 0; } int fj(int m,int min) { int counter=1; int i; if(m<min) return 0; for(i=min;i<m;i++) if(m%i==0) { counter=fj(m/i,i)+counter; } return counter; }
1
98
/* * 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
99
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