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 15pengyi at 2005-04-30 21:37:10 on Problem 2136
program pku2136;
var i,k:integer;
    ch,c:char;
    t:array['A'..'Z'] of integer;
    b:array['A'..'Z'] of boolean;
    str:string[72];
begin
   for i:=1 to 4 do
   begin
      readln(str);
      for k:=1 to length(str) do
         if (str[k]>='A')and(str[k]<='Z') then t[str[k]]:=t[str[k]]+1;
   end;
   ch:='A';
   while t[ch]>0 do
   begin
      fillchar(b,sizeof(b),false);
      ch:='A';
      for c:='B' to 'Z' do
         if t[c]>=t[ch] then ch:=c;
      for c:='A' to pred(ch) do
         if t[c]=t[ch] then b[c]:=true;
      for c:='A' to pred(ch) do
         if b[c] then begin
                         write('* ');
                         t[c]:=t[c]-1;
                      end
                 else write('  ');
      writeln('*');
      t[ch]:=t[ch]-1;
   end;
   write('A');
   for c:='B' to 'Z' do write(' ',c);
   writeln;
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