| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
help !help!那位好心同志给改一下 ,总是超时,气死我了!谢谢了!2105-IP Address#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator