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;
}

 

posted @ 2021-11-13 21:12  智人心  阅读(26)  评论(0)    收藏  举报