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 "stdio.h" int main() { int cases; int i,j,k; int sum; int ip[4]; char str[32]; scanf("%d",&cases); for(i=1;i<=cases;i++) { scanf("%s",str); for(j=0;j<4;j++) { sum=0; for(k=j*8;k<(j+1)*8;k++) { sum=sum*2+str[k]-'0'; } ip[j]=sum; } printf("%d.%d.%d.%d\n",ip[0],ip[1],ip[2],ip[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