}
return0;
}
建议C和C++语言两个版本都自己编写提交
例7:
IPAddress
简单的说就是8个0或1为一个数,要你转化为十进制数(但是要注意格式)
Supposeyouarereadingbytestreamsfromanydevice,representingIPaddresses.Yourtaskistoconverta32characterslongsequenceof'1s'and'0s'(bits)toadotteddecimalformat.AdotteddecimalformatforanIPaddressisformbygrouping8bitsatatimeandconvertingthebinaryrepresentationtodecimalrepresentation.Any8bitsisavalidpartofanIPaddress.Toconvertbinarynumberstodecimalnumbersrememberthatbotharepositionalnumericalsystems,wherethefirst8positionsofthebinarysystemsare:
27
26
25
24
23
22
21
20
128
64
32
16
8
4
2
1
Input
TheinputwillhaveanumberN(1<=N<=9)initsfirstlinerepresentingthenumberofstreamstoconvert.Nlineswillfollow.
Output
TheoutputmusthaveNlineswithadoteddecimalIPaddress.AdotteddecimalIPaddressisformedbygrouping8bitatthetimeandconvertingthebinaryrepresentationtodecimalrepresentation.
SampleInput
4
00000000000000000000000000000000
00000011100000001111111111111111
11001011100001001110010110000000
01010000000100000000000000000001
SampleOutput
0.0.0.0
3.128.255.255
203.132.