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

why my submission is always wrong anwser?

Posted by niuniu2006 at 2007-04-14 15:47:26 on Problem 1131
高手们 指点一下迷津吧 跪求!
#include<iostream>
using namespace std;

int main()
{
	char a[1000];
	
	double di=8;
long double sum=0;
for(int wo=0;wo<=6;++wo){
     cin>>a;
     
	if(a[0]-'0'==1)
	{cout<<'1'<<' '<<"[8]"<<' '<<'='<<' '<<"1"<<' '<<"[10]"<<endl;sum=0;di=8;continue;}
	for(int i=2;a[i];++i)
	{
		sum+=1.0*(a[i]-'0')/di;
		di*=8.0;

	}if(a[0]-'0'==0&&a[1]=='\0')
	{cout<<'0'<<' '<<"[8]"<<' '<<'='<<' '<<"0"<<' '<<"[10]"<<endl;sum=0;di=8;continue;}
	cout<<a<<' '<<"[8]"<<' '<<'='<<' '<<"0.";
	for( i=0;sum>=1e-8;++i)
	{
		 sum*=10;
		 cout<<int(sum);
		 sum-=int(sum);
}cout<<' '<<"[10]"<<endl;sum=0;di=8;}
	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