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

What is wrong with it>?

Posted by vxk at 2003-11-11 16:16:53 on Problem 1007
program fd;
type
 DNAStr=Record
  s:integer;
  ch:string[100];
 end;
var
k,p,m,n,a:integer;
dna:array [1..50] of DNAStr;
procedure quicksort(s,t:integer);
var
x:dnaStr;
i,j:integer;
Begin
x:=dna[s];
i:=s;
j:=t;
While j>i do
begin
 while (dna[j].s>=x.s)and(j>i) do j:=j-1;
 if j>i then begin dna[i]:=dna[j]; i:=i+1; end;
 while (dna[i].s<=x.s)and(i<j) do i:=i+1;
 if i<j then begin dna[j]:=dna[i]; j:=j-1; end;
 dna[i]:=x;
end;

if s<i-1 then quicksort(s,i-1);
if t>i+1 then quicksort(i+1,t);
end;
begin
fillchar(dna,sizeof(dna),0);
readln(m,n);
for k:=1 to n do
   readln(dna[k].ch);
for k:=1 to n do
 for a:=0 to m-1 do
 for p:=a+1 to m do
    if ord(dna[k].ch[a])>ord(dna[k].ch[p]) then dna[k].s:=dna[k].s+1;
quicksort(1,n);
for k:=1 to n do
   writeln(dna[k].ch);
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