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 |
为什么WA????哪位路过的大虾帮个忙~~感激涕零#include<iostream> using namespace std; int a[8]={128,64,32,16,8,4,2,1}; int main() { int i,j,k,m,temp; char ip[8][32]; int IP[8][4]={0}; scanf("%d",&m); getchar(); for(i=0;i<m;i++) { for(j=0;j<32;j++) scanf("%c",&ip[i][j]); getchar(); } for(i=0;i<m;i++) { temp=0; for(j=0;j<4;j++) { IP[i][j]=0; for(k=temp;k<8+temp;k++) { IP[i][j]=(ip[i][k]-'0')*a[k-temp]+IP[i][j]; } temp+=8; } } for(i=0;i<m;i++) printf("%d.%d.%d.%d\n",IP[i][0],IP[i][1],IP[i][2],IP[i][3]); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator