What is 80-kb resolution# Biology - 生物学
j*l
1 楼
#define MAX_SIZE 1000
void LargeFactorial(int n)
{
if (n < 0)
{
printf("Please make sure n >= 0.\n");
return;
}
int A[MAX_SIZE];
A[0] = 1;
int top = 1;
int i, j;
for (i = 2; i <= n; i++)
{
for (j = 0; j < top; j++)
A[j] *= i; // Should better check if A[j] is larger than MAX_INT
int carry = 0;
for (j = 0; j < top; j++)
{
int x = A[j] + carry;
A[j] = x % 10;
carry =
void LargeFactorial(int n)
{
if (n < 0)
{
printf("Please make sure n >= 0.\n");
return;
}
int A[MAX_SIZE];
A[0] = 1;
int top = 1;
int i, j;
for (i = 2; i <= n; i++)
{
for (j = 0; j < top; j++)
A[j] *= i; // Should better check if A[j] is larger than MAX_INT
int carry = 0;
for (j = 0; j < top; j++)
{
int x = A[j] + carry;
A[j] = x % 10;
carry =