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 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator