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 |
我怎么会WA啊?在机器上测试是对的啊,希望大家帮帮忙啊program pku1002; var a:array[1.1000] of string[15]; b:array[1..1000] of string[12]; c:array['A'..'Y'] of '2'..'9'; d:array[1..1000] of integer; ch:char; s:string; n,i,j,k,m:integer; begin j:=2; for ch:='A' to 'O' do begin inc(j); c[ch]:=chr(j div 3 +1+ord('0')); end; c['P']:='7'; c['R']:='7'; c['S']:='7';j:=j+3; for ch:='T' to 'Y' do begin inc(j); c[ch]:=chr(j div 3 +1+ord('0')); end; readln (n); for i:=1 to n do begin readln (a[i]); for j:=1 to length(a[i]) do if a[i,j]<>'-' then if (a[i,j]>='A') and (a[i,j]<'Z') then b[i]:=b[i]+c[a[i,j]] else b[i]:=b[i]+a[i,j]; insert('-',b[i],4); end; m:=0; for i:=1 to n-1 do begin k:=1; for j:=i+1 to n do if b[i]<>' ' then if b[i]=b[j] then begin inc(k); b[j]:=' '; end; if k>1 then begin inc(m);b[m]:=b[i]; d[m]:=k; end; end; for i:=1 to m-1 do begin k:=i; for j:=i+1 to m do if b[k]>b[j] then k:=j; if k<>i then begin s:=b[k]; b[k]:=b[i]; b[i]:=s; n:=d[k]; d[k]:=d[i]; d[i]:=n; end; end; if m=0 then writeln ('No duplicates.') else for i:=1 to m do writeln (b[i],' ',d[i]); end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator