Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:最大的结果位数超过2000, long 放不了,须用高精密数

Posted by Skyscraper at 2006-07-26 15:08:59 on Problem 1405
In Reply To:各位大哥,1405题当人数大于10的时候,数的位数不够了,我就没招了。我是新手,帮帮忙! Posted by:baichen at 2006-07-19 20:41:14
> /*about the rich ancle*/
> #include<stdio.h>
> main()
> {int i,j;
>  unsigned long temp=1,sum=0;
>  unsigned long c[18],d[18];
>  int n;
>  int x=2;/*用来恢复j的值*/
> 
> 
>  printf("Please input the number of your realatives:");
>  scanf("%d",&n);
> 
> 
>  for(j=2;j<18;j=x)
>    {for(i=0;i<n;i++)
>       {c[i]=j;
>        j+=1;
>       }
>      for(i=0;i<n;i++)
>       temp*=c[i] ;
>       for(i=0;i<n;i++)
>         {d[i]=temp/c[i];
>          sum+=d[i];
>          }
>       if(sum<temp)
>          break;
>        else
>         {sum=0;
>          temp=1;
>         }
>         x+=1;
>      }
> 
>    for(i=0;i<n;i++)
>       {
>         printf("%d\n",c[i]);
>        }
> 
> }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator