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:为什么我转换成26进制就超时呢?不可能吧?

Posted by yufuwan1 at 2008-06-08 19:26:42 on Problem 2273
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:
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