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 |
例子过的很好呀,为什么会错呢,求求各位大牛了!!//pku_2105 #include<stdio.h> #include<math.h> void main() { char a[33]; int i=0,j=0,n,t[9][4],b[9][32],k=0; for(i=0;i<4;i++) for(j=0;j<9;j++) t[i][j]=0; scanf("%d",&n); if(n>=1&&n<=9) { for(i=0;i<n;i++) { scanf("%s",a); for(j=0;j<32;j++) b[i][j]=a[j]-48; } for(i=0;i<4;i++) { for(j=31;j>=0;j--) { k=j%8; if(k!=0) b[i][j]=b[i][j]*(int)pow(2,7-k); else b[i][j]=b[i][j]*(int)pow(2,7); } } for(i=0;i<n;i++) { k=0; for(j=31;j>=0;j--) { if((j%8)!=0) t[i][k]+=b[i][j]; else { t[i][k]+=b[i][j]; k++; } } } for(i=0;i<n;i++) printf("%d.%d.%d.%d\n",t[i][3],t[i][2],t[i][1],t[i][0]); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator