|  | 
|  | 
| back to board | WA 5. Maybe i read incorrect data? Posted by Lifanov  31 Mar 2005 18:22unsigned int convert(char *a){unsigned int S=0,t;
 int j=0;
 for(int i=0;i<3;i++){
 S*=256;
 t=0;
 while(a[j]!='.'){
 t+=a[j]-'0';
 t*=10;
 j++;
 }
 S+=t;
 }
 j=0;
 t=0;
 for(;j<strlen(a);j++){
 t*=10;
 t+=a[j]-'0';
 
 }
 S*=256;
 S+=t;
 return S;
 }
 void read(int n){ // n -index PC
 int k,i;
 char ip[100],mask[100];
 scanf("%d",&k);
 Count[n]=k;
 for(i=0;i<k;i++){
 scanf("%s %s",ip,mask);
 IP[n][i]=convert(ip);
 Mask[n][i]=convert(mask);
 //    printf("%s %s %u %u\n",ip,mask,IP[n][i],Mask[n][i]);
 }
 }
I change Analysis string to sscanf("%d.%d....); and get AC. | 
 | 
|