| ||||||||||
| 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 | |||||||||
明显没错的!!program p2419;
var person:array[1..100]of string[100];
use:array[1..100]of boolean;
out:byte;
p,t:byte;
procedure init;
var i,k:integer;
j:char;
begin
readln(p,t);
repeat
readln(i,j,j);
k:=pos(j,person[i]);
if k=0 then person[i]:=person[i]+j;
until eof;
end;
procedure swap(var x,y:char);
var i:char;
begin
i:=x;x:=y;y:=i;
end;
procedure qsort(l,r,k:integer);
var i,j:integer;mid:char;
begin
i:=l;j:=r;mid:=person[k,(i+j) div 2];
repeat
while person[k,i]<mid do inc(i);
while person[k,j]>mid do dec(j);
if i<=j then begin
swap(person[k,i],person[k,j]);
inc(i);
dec(j);
end;
until i>j;
if l<j then qsort(l,j,k);
if i<r then qsort(i,r,k);
end;
procedure main;
var i,j:integer;
begin
for i:=1 to p do
qsort(1,length(person[i]),i);
for i:=1 to p do
begin
if use[i] then continue;
inc(out);
use[i]:=true;
for j:=i+1 to p do
if person[i]=person[j] then use[j]:=true;
end;
end;
begin
out:=0;
fillchar(use,sizeof(use),false);
init;
main;
writeln(out);
end.
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator