poj 2105(水题)
#include<iostream> using namespace std; int main(){ int n,ip[4],i,j,base; char a[35]; scanf("%d",&n); while(n--){ scanf("%s",a); for(j=0;j<4;j++){ ip[j] = 0; base = 128; for(i=0;i<8;i++){ ip[j] += base*(a[i+j*8]-'0'); base /= 2; } } for(j=0;j<3;j++){ printf("%d.",ip[j]); } printf("%d\n",ip[3]); } return 0; }
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号