| ||||||||||
| 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 | |||||||||
Re:PASCAL 1ACIn Reply To:PASCAL 1AC Posted by:aiouniya at 2012-08-24 16:04:41 你特马SB看看大神的1AC吧
const
ep:array [1..8] of integer=(1,2,4,8,16,32,64,128);
var
n,i,j,nc,op:integer;
s,p:string;
aa:array [1..8] of integer;
begin
readln(n);
for i:=1 to n do
begin
s:='';
readln(s);
p:=copy(s,1,8);
delete(s,1,8);
for j:=1 to 8 do
aa[8-j+1]:=ord(p[j])-48;
nc:=0;p:='';
for j:=1 to 8 do nc:=nc+ep[j]*aa[j];
write(nc);
for op:=1 to 3 do
begin
p:=copy(s,1,8);
delete(s,1,8);
for j:=1 to 8 do
aa[8-j+1]:=ord(p[j])-48;
nc:=0;p:='';
for j:=1 to 8 do nc:=nc+ep[j]*aa[j];
write('.',nc);
end;
writeln;
end;
end.
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator