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高手帮忙看一下好么?总是WA?为什么啊?Program PKU1002; Var A:Array [-1..9999999] of Word; Help:Word; n,I,J,save:Longint; Function Change(S:String):Longint; var ii:integer; F:Boolean; begin Change:=0; F:=False; save:=-1; {For ii:=1 to Length(S) do if S[i] in ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','R','S','T','U','V', 'W','X','Y'] THEN F:=True;} //If F then //begin If Change<=999999 then For ii:=1 to Length(S) do begin Case S[ii] of '0': Change:=Change*10; '1': Change:=Change*10+1; '2','A','B','C':Change:=Change*10+2; '3','D','E','F':Change:=Change*10+3; '4','G','H','I':Change:=Change*10+4; '5','J','K','L':Change:=Change*10+5; '6','M','N','O':Change:=Change*10+6; '7','P','R','S':Change:=Change*10+7; '8','T','U','V':Change:=Change*10+8; '9','W','X','Y':Change:=Change*10+9; end; end; //end //else if Change=0 then for ii:=1 to Length(S) do if S[ii]='0' then break else Change:=-1; end; procedure Init; Var S:string; Result:Longint; begin FillChar(A,SizeOf(A),0); Readln(n); For i:=1 to n do begin Readln(S); Result:=Change(S); If A[Result]<60000 then Inc(A[Result]) else begin help:=59999; A[Result]:=2; save:=Result; end; end; end; procedure Main; begin end; procedure Print; var S:String; Find:Boolean; begin Find:=False; For i:=0 to 9999999 do begin if A[i]>1 then begin Find:=True; Str(i,S); While Length(S)<7 do Insert('0',S,1); For j:=1 to 3 do write(S[J]); write('-'); For j:=4 to 7 do write(S[J]); write(' '); if i=save then writeln(A[i]+help) else writeln(A[i]); end; end; if Not Find then Writeln('No duplicates.'); end; begin Init; Main; Print; end. Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator