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 |
大牛来看看Runtime Error!我用VC都通过,哪有问题呀!#include "stdio.h" int power(int n) { int i,power=1; if(n==0) return 1; else { for(i=0;i<n;i++) power*=2; return power; } } void main() { freopen("2105 IP Address.txt","r",stdin); int t,i,j,n; char ip[33]; scanf("%d",&n); int **a; a=new int *[n]; for(i=0;i<4;i++) a[i]=new int [4]; for(t=0;t<n;t++) { scanf("%s",ip); for(i=0;i<4;i++) { a[t][i]=0; for(j=8*i;j<8*i+8;j++) a[t][i]+=(ip[j]-'0')*power(7+8*i-j); } } for(t=0;t<n;t++) printf("%d.%d.%d.%d\n",a[t][0],a[t][1],a[t][2],a[t][3]); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator