| ||||||||||
| 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 | |||||||||
為什么老是Runtime Error?program lt;
var
i,j,k,l,n,m,z,q:integer;
c1,c2,c3:integer;
c5:string;
a:array[0..10000,0..10] of string[1];
b:array[0..10000] of integer;
st,st1,st2:string;
bb:boolean;
begin
readln(n);
for K:=1 to n do
begin
readln(st);
l:=length(st);
m:=0;
for i:=1 to l do
begin
st1:=copy(st,i,1);
inc(m);
if st1='0' then a[k,m]:='0';
if st1='1' then a[k,m]:='1';
if st1='2' then a[k,m]:='2';
if st1='3' then a[k,m]:='3';
if st1='4' then a[k,m]:='4';
if st1='5' then a[k,m]:='5';
if st1='6' then a[k,m]:='6';
if st1='7' then a[k,m]:='7';
if st1='8' then a[k,m]:='8';
if st1='9' then a[k,m]:='9';
if (st1='A') or (st1='B') or (st1='C') then a[k,m]:='2';
if (st1='D') or (st1='E') or (st1='F') then a[k,m]:='3';
if (st1='G') or (st1='H') or (st1='I') then a[k,m]:='4';
if (st1='J') or (st1='K') or (st1='L') then a[k,m]:='5';
if (st1='M') or (st1='N') or (st1='O') then a[k,m]:='6';
if (st1='P') or (st1='R') or (st1='S') then a[k,m]:='7';
if (st1='T') or (st1='U') or (st1='V') then a[k,m]:='8';
if (st1='W') or (st1='X') or (st1='Y') then a[k,m]:='9';
if a[k,m]='' then dec(m);
end;
end;
for i:=1 to n-1 do
for j:=i+1 to n do
begin
if a[i,1]='' then break;
q:=0;
for z:=1 to 7 do
if a[i,z]=a[j,z] then inc(q) else break;
if q=7 then
begin
a[j,1]:='';
inc(b[i]);
end;
end;
{huan}
bb:=true;
for i:=1 to n-1 do
for j:=i+1 to n do
for c1:=1 to 7 do
begin
if (a[i,c1]='') or (a[j,c1]='') then break;
if a[i,c1]>a[j,c1] then
begin
for c2:=1 to 7 do
begin
c5:=a[i,c2];
a[i,c2]:=a[j,c2];
a[j,c2]:=c5;
end;
c3:=b[i];
b[i]:=b[j];
b[j]:=c3;
break;
end else if a[i,c1]<a[j,c1] then break;
end;
for i:=1 to n do
if b[i]<>0 then
begin
for j:=1 to 7 do
begin
bb:=false;
if j=4 then write('-');
write(a[i,j]);
end;
writeln(' ',b[i]+1);
end;
if bb then writeln('No duplicates.');
end.
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator