| ||||||||||
| 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 | |||||||||
一个比较屌丝的代码,终于AC了。⊙﹏⊙b汗const
map:array['A'..'Z'] of char=('2','2','2','3','3','3','4','4','4','5','5','5','6','6','6','7','7','7','7','8','8','8','9','9','9','9');
//shu:array[1..7] of longint=(1000000,100000,10000,1000,100,10,1);
type
arr=array[1..300] of char;
var
data:array[1..100001] of ansistring;
s:ansistring;
i,n,num,j:longint;
flag:boolean;
procedure qsort(h,t:longint);
var
m,tmp:ansistring;
i,j:longint;
begin
m:=data[(h+t) div 2];
i:=h;
j:=t;
repeat
while data[i]<m do inc(i);
while data[j]>m do dec(j);
if i<=j then
begin
tmp:=data[i];
data[i]:=data[j];
data[j]:=tmp;
inc(i);
dec(j);
end;
until i>j;
if h<j then qsort(h,j);
if i<t then qsort(i,t);
end;
procedure hash(j:longint);
var
i:longint;
c:string;
begin
c:='';
for i:=1 to length(s) do
if s[i]<>'-' then
begin
if s[i] in ['0'..'9'] then c:=c+s[i]
else if (s[i]<>'Q') and (s[i]<>'Z') and (s[i] in ['A'..'Z']) then c:=c+map[s[i]];
end;
data[j]:=c;
end;
begin
readln(n);
for i:=1 to n do
begin
readln(s);
hash(i);
end;
qsort(1,n);
i:=1;
flag:=true;
while i<n do
begin
num:=1;
while data[i]=data[i+1] do
begin
inc(num);
inc(i);
end;
if num>1 then
begin
writeln(data[i,1],data[i,2],data[i,3],'-',data[i,4],data[i,5],data[i,6],data[i,7],' ',num);
flag:=false;
end;
inc(i);
end;
if flag 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