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 |
我的PASCAL的AC代码……话说PASCAL效率就这么低? 和C++几百MS的时间差距真是杯具 program poj1002; const b:array['A'..'Z'] of integer= (2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,0,7,7,8,8,8,9,9,9,0); var a:array[0..10000000] of longint; i,e,o,s,n,t,j,bj:longint; st,ans,d:string; begin readln(n); for t:=1 to n do begin readln(st); s:=0; e:=0; for i:=1 to length(st) do if (st[i]>='0') and (st[i]<='9') then begin d:=st[i]; val(d,e,o); s:=s*10+e; end else if (st[i]>='A') and (st[i]<='Z') then begin s:=s*10+b[st[i]]; end; inc(a[s]); end; bj:=0; for i:=0 to 9999999 do if a[i]>1 then begin bj:=1; st:=''; ans:=''; str(i,st); for j:=1 to 7-length(st) do ans:=ans+'0'; ans:=ans+st; for j:=1 to 3 do write(ans[j]); write('-'); for j:=4 to 7 do write(ans[j]); writeln(' ',a[i]); end; if bj=0 then writeln('No duplicates.'); end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator