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:为什么我转换成26进制就超时呢?不可能吧?In Reply To:为什么我转换成26进制就超时呢?不可能吧? Posted by:yufuwan1 at 2008-06-07 17:12:43 > #include<stdio.h> > #include<string.h> > int main() > { > while(1) > { > long a,b; > long r[100]={0}; > int i=1; > int j; > while(getchar()!='\n') > { > scanf("%ldC%ld",&a,&b); > if((a==0)&&(b==0)) > break; > if(b<=26) > { > printf("%c%ld\n",b+'A'-1,a); > > } > else > { > r[0]=b%26; > while(b/26) > { > b/=26; > if(r[i-1]==0) > { > r[i-1]+=26; > b-=1; > } > r[i]=b%26; > i++; > } > for(j=i-1;j>=0;j--) > { > printf("%c",r[j]+'A'-1); > } > printf("%ld\n",a); > } > } > } > return 0; > } > > > > Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator