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:按公式来算为什么WA了?

Posted by appetite at 2006-02-04 23:50:01 on Problem 1781
In Reply To:Re:按公式来算为什么WA了? Posted by:oeym at 2006-02-04 12:02:34
> #include <stdio.h>
> #include <string.h>
> 
> int main()
> {
> 	__int64 twobase[31], tenbase[10];
> 	int i, j,;
> 	__int64 n;
> 	char in[4];
> 	twobase[0] = 1;
> 	tenbase[0] = 1;
> 
> 	for (i = 1; i < 31; i++)
> 	{
> 		twobase[i] = twobase[i-1] + twobase[i-1];	
> 	}
> 	
> 	for (i = 1; i < 10; i++)
> 	{
> 		tenbase[i] = 10 * tenbase[i-1];	
> 	}
> 	
> 	while(scanf("%s", in)!= -1 && strcmp(in, "00e0") != 0)
> 	{
> 		n = (in[0] - '0') * 10 + (in[1] - '0');
> 		n *= tenbase[in[3]-'0'];
> 		for (i = 0; i < 30; i++)
> 		{
> 			if (n < twobase[i+1])
> 			{
                                   ~~~~~~~n<=twobase[i + 1]
> 				break;	
> 			}	
> 		}
> 		n = (n - twobase[i]) * 2 + 1;
> 		printf("%I64d\n",n);	
> 	}
> 	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