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

明显没错的!!

Posted by My_loves at 2005-08-16 14:33:59 on Problem 2419
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:
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