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

我得,怎么就有wa

Posted by drownever at 2006-12-20 10:36:00 on Problem 2105
#include<iostream.h>
#include<stdio.h>
int cf(int a);
int main()
{
	int t;
	cin>>t;
	if(t<0||t>9)
		return 0;
	while(t--)
	{
		int temp=0,res;
		int g=0;
		char byte[32];
		for(int j=0;j<32;j++)
		{
			char c;
			while(1)
			{
				c=getchar();
				if(c=='0'||c=='1')
					break;
				else 
					continue;
			}
			byte[g++]=c;

		}

		for(int v=1;v<=3;v++)
		{
			res=0;
			for(int i=7;i>=0;i--)
			{
			    res=res+cf(i)*(byte[temp++]-'0');
			}
			cout<<res<<'.';
		}
		    res=0;
			for(int i=7;i>=0;i--)
			{
			    res=res+cf(i)*(byte[temp++]-'0');
			}
			cout<<res<<endl;
	}
	return 0;
}

int cf(int a)
{
	int sum=1;
	for(int i=0;i<a;i++)
	{
		sum=sum*2;
	}
	return sum;
}

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