instruction:
This task is to find the number of 'For' loops present in the given cpp program.
question:

/**
* @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);
}
}
}
answer:
2

question:
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
",ys(a[i],2));
}
return 0;
}

answer:
3

question:
/*
*?????
*???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;
}
}
answer:
5