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

someone to help me with my code

Posted by teladod at 2011-02-07 07:28:47 on Problem 3650
i don't undestand why is wrong answer with my code .. please..
someome tell me where is the mistake in my code ... here is my code

program p3650; {--The Seven Percent Solution--}

{--procedimiento--}
procedure p_insertar(var palabra:string;var i,tam:integer);
var
	aux1,aux:string;
begin
	if i=tam then aux:=''
	else aux:=copy(palabra,i+1,tam);
	aux1:=copy(palabra,1,i-1);
	if palabra[i] ='%' then palabra:=aux1+'%25'+aux else
           begin
	        if palabra[i] ='!' then palabra:=aux1+'%21'+aux;
	        if palabra[i] ='$' then palabra:=aux1+'%24'+aux;
	        if palabra[i] =' ' then palabra:=aux1+'%20'+aux;
	        if palabra[i] ='(' then palabra:=aux1+'%28'+aux;
	        if palabra[i] =')' then palabra:=aux1+'%29'+aux;
	        if palabra[i] ='*' then palabra:=aux1+'%2a'+aux;
           end;
end;
{---principal----}
var
	palabra:String;
	i,tam:Integer;
begin
	repeat
		readln(palabra);
		if palabra <>'#' then begin
			tam:=length(palabra);
			i:=1;
			while i<= tam do begin
				if palabra[i] in [' ','!','$','%','(',')','*'] then begin
					p_insertar(palabra,i,tam);
					i:=i+1;
					tam:=tam+3;
				end;
				i:=i+1;
			end;
			writeln(palabra);
		end;
	until palabra='#';
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