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

庆祝下第一道题~~

Posted by WaterBird at 2011-03-10 11:06:29 on Problem 1131
#include<cstdio>
#include<cstring>
char c[50];
int i,l;
double x,y;
int main()
{
	while(scanf("%s",c)!=EOF){
		printf("%s [8] = ",c);
		l=strlen(c)-1;
		x=0;y=1;
		for(i=l;i>1;i--){
			x=((c[i]-'0')*y+x)*125;
			y*=1000;
		}
		x/=y;
		i=0;
		while(x){c[i]=int(x*=10)%10+'0';x-=c[i]-'0';i++;}
		c[i]='\0';
		printf("0.%s [10]\n",c);
	}
}

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