标签:
Time Limit: 1000MS | Memory Limit: 30000K | |
Total Submissions: 18951 | Accepted: 10939 |
Description
27
26
25
24
23
22
21
20
128 64 32 16 8 4 2 1
Input
Output
Sample Input
4 00000000000000000000000000000000 00000011100000001111111111111111 11001011100001001110010110000000 01010000000100000000000000000001
Sample Output
0.0.0.0 3.128.255.255 203.132.229.128 80.16.0.1
Source
1 #include <cstdio> 2 #include<algorithm> 3 #include<iostream> 4 #include<string> 5 #include<cstring> 6 #include<vector> 7 using namespace std; 8 int b[8]={128,64,32,16,8,4,2,1}; 9 int main(){ 10 int n; 11 string s; 12 while(cin>>n){ 13 while(n--){ 14 cin>>s; 15 int i,j,k=0; 16 for(i=0;i<=31;){ 17 int sum=0; 18 j=0; 19 while(j<8){ 20 if(s[i]==‘1‘) 21 sum+=b[i%8]; 22 i++; 23 j++; 24 } 25 cout<<sum; 26 if(k<3){ 27 cout<<‘.‘; 28 } 29 else{ 30 cout<<endl; 31 } 32 k++; 33 } 34 } 35 } 36 return 0; 37 }
标签:
原文地址:http://www.cnblogs.com/Deribs4/p/4294036.html