Hello,

Here my two cents to V's program.

When numbers going to be super big, one may find the most time
consuming part is on the "carry", because every 1 digit needs one
carry. For VFIX, if you can have every 5 digit per carry, e.g. carry
once per 10000, your program will be fast enough for super big
numbers.

phunter

On Fri, Aug 12, 2011 at 11:24 AM, VFIX <[email protected]> wrote:
> #include<stdio.h>
> int main(void)
> {
> int x[20000],i=0,j=0,k=1,y=0,t=1,n=0,l=0,carry=0;
>
> while(k){
> printf("\nenter the value ");
> scanf("%d",&n);
> x[0]=1;t=1;
> for(i=2;i<=n;i++)
> {l=i;
> for(j=0;j<t;j++)
>  {y=x[j]*l+carry;
>    x[j]=y%10;
>   carry=y/10;
>  }
>  while(carry>0)
>  {x[t]=carry%10;
>  carry=carry/10;
>  t++;
>  }
>
> }
>
> for(i=t-1;i>-1;i--)
> printf("%d",x[i]);
> printf("\n");
> printf("enter 0 to exit, any other integer to continue.. ");
> scanf("%d",&k);
> }
> }
>
> On Aug 12, 11:00 pm, Leopoldo Taravilse <[email protected]> wrote:
>> 0! is not 0, it's 1
>
> --
> You received this message because you are subscribed to the Google Groups 
> "google-codejam" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-code?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to