| ||||||||||
| 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 | |||||||||
where no term in the sum exactly divides any other term in the sum.In Reply To:让3的次数一直为0,用2的n次方来表示原数,老WA,那位仁兄可否帮忙看看? Posted by:qwynick at 2007-09-12 16:27:53 > #include<stdio.h>
> __int64 d[40],z[40];
> int main()
> {
> // freopen("wrw.txt","w",stdout);
> __int64 cs,c,i,n,top;
> d[0]=1;
> for(i=1;i<40;i++)
> d[i]=d[i-1]*2;
> scanf("%I64d",&cs);
> for(c=1;c<=cs;c++)
> {
> scanf("%I64d",&n);
> top=0;
> printf("%I64d",c);
> for(i=39;i>=0;i--)
> if(d[i]<=n)
> {
> n-=d[i];
> z[top++]=i;
> }
> printf(" %I64d",top);
> for(;top>0;)
> printf(" [%I64d,0]",z[--top]);
> printf("\n");
> }
> return 0;
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator