| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:最大的结果位数超过2000, long 放不了,须用高精密数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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator