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

help !help!那位好心同志给改一下 ,总是超时,气死我了!谢谢了!2105-IP Address

Posted by face1128 at 2007-05-13 17:40:54
#include<iostream.h>
#include<math.h>
void ip(char *a)
{
	double b[4];
	int j;
	for(j=0;j<4;j++)
	{
		b[j]=0;
	    for(int k=7;k>=0;k--)
	   {
		 b[j]+=(*a-48)*pow(2,k);
		 a++;
	   }
	}
    cout<<b[0]<<'.'<<b[1]<<'.'<<b[2]<<'.'<<b[3]<<endl;
}
void main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
        char* a=new char[32];
		cin>>a;
		ip(a);
	}
}

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