| ||||||||||
| 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:谁能告诉我哪错了?郁闷啊。sample都弄出来了,貌似不可能WA啊。In Reply To:谁能告诉我哪错了?郁闷啊。sample都弄出来了,貌似不可能WA啊。 Posted by:playerdell at 2007-07-20 14:37:33 > #include<stdio.h>
> void main()
> {
> unsigned __int64 bin[64];
> int i,flag;
> unsigned __int64 n,temp1,temp2,max=1000000000000000000;
> scanf("%I64u",&n);
> while(n!=0)
> {
> temp1=1;
> temp2=0;
> flag=0;
> n--;
> for(i=0;i<64;i++)
> {
> bin[i]=n%2;
> n/=2;
> }
> printf("{");
> if(bin[0]==1)
> {
> printf(" %I64u",temp1);
> flag=1;
> }
> for(i=1;i<64;i++)
> {
> temp1*=3;
> temp2*=3;
> if(temp1>=max)
> {
> temp2+=(temp1/max);
> temp1%=max;
> }
> if(bin[i]==1)
> {
> if(flag==1)
> printf(",");
> if(temp2!=0)
> printf(" %I64u",temp2);
> else
> printf(" ");
> printf("%I64u",temp1);
> flag=1;
> }
> }
> printf(" }\n");
> scanf("%I64u",&n);
> }
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator