Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

PASCAL 1AC

Posted by aiouniya at 2012-08-24 16:04:41 on Problem 2105
const 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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator