Home > Back-end >  5!=1 * 2 * 3 * 4 * 5. Introducing a new concept of factorial, by each of the original number multipl
5!=1 * 2 * 3 * 4 * 5. Introducing a new concept of factorial, by each of the original number multipl

Time:06-09

For bosses to solve this problem is # include
Int main (void)
{
Int I, a, n, j, m, d, sum;
The scanf (" % d ", & amp; A);
While (a -)
{
The scanf (" % d ", & amp; N);
D=0;
For (I=1; I & lt;=n; I++)
{
Sum=1;
For (j=1; J & lt;=I; J++)
{
While (j % 2==0)
The sum *=j;
}
D=d + sum;
}
printf("%d\n",d);
}
return 0;
} this is me, don't know how to change the while where

CodePudding user response:

Starting from 2, don't need while
 
# include
Int main (void)
{
Int I, a, n, j, m, d, sum;
The scanf (" % d ", & amp; A);
While (a -)
{
The scanf (" % d ", & amp; N);
D=0;
For (I=2; I & lt;=n; I++)
{
Sum=1;
For (j=1; J & lt;=I; J++)
{
If (j % 2==0)
The sum *=j;
}
D=d + sum;
}
Printf (" % d \ n ", d);
}
return 0;
}

CodePudding user response:

For (j=2; J & lt;=I; J +=2)
Why all traversal and then screen out half?

CodePudding user response:

reference 1st floor Italink response:
since 2, don't need while
 
# include
Int main (void)
{
Int I, a, n, j, m, d, sum;
The scanf (" % d ", & amp; A);
While (a -)
{
The scanf (" % d ", & amp; N);
D=0;
For (I=2; I & lt;=n; I++)
{
Sum=1;
For (j=1; J & lt;=I; J++)
{
If (j % 2==0)
The sum *=j;
}
D=d + sum;
}
Printf (" % d \ n ", d);
}
return 0;
}

Why don't I run out o

CodePudding user response:

This nothing new, n!!!!!=2 ^ (n/2) * (n/2)! Is actually (n/2)! Left n/2

CodePudding user response:

references 4 floor early play play nuclear response:
this nothing new, n!!!!!=2 ^ (n/2) * (n/2)! Is actually (n/2)! Left n/2

What do you mean??????????

CodePudding user response:

references 4 floor early play play nuclear response:
this nothing new, n!!!!!=2 ^ (n/2) * (n/2)! Is actually (n/2)! Left n/2

The title means 4!!!!=2 * 4 5!!!!!=2 * 4 6!!!!!=2 * 4 * 6

CodePudding user response:

refer to 6th floor qq_45815575 response:
Quote: refer to 4th floor early play big play nuclear war reply:
this there is nothing new, n!!!!!=2 ^ (n/2) * (n/2)! Is actually (n/2)! Left n/2

The title means 4!!!!=2 * 4 5!!!!!=2 * 4 6!!!!!=2 * 4 * 6


What's the problem? 5!!!!!=2 ^ (5/2) * (5/2)!=4 * 2!=8

CodePudding user response:

5!!!!!=2 * 4=1 * 2 * 2 * 2=2! X 2 ^ 2
6!!!!!=2 x 4 x 6=1 * 2 * 2 * 2 * 3 * 2=1 * 2 * 3 * 2 ^ 3=3! X 2 ^ 3

CodePudding user response:


I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html
  • Related