Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
PASCAL 1ACconst a1:array[1..8]of integer=(128,64,32,16,8,4,2,1); var n,i:integer; str:string; function IP(a,b:integer):integer; var sum,i,l:integer; begin sum:=0; for i:=b downto a do if str[i]='1' then sum:=sum+a1[i-a+1]; IP:=sum; end; begin readln(n); for i:=1 to n do begin readln(str); writeln(IP(1,8),'.',IP(9,16),'.',IP(17,24),'.',IP(25,32)); end; end. Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator