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

那位神牛看看,。为什么会输出格式错误。。

Posted by 597100700 at 2011-09-15 22:45:02 on Problem 3617
var a,b,c,d,e,m,n,sum:longint;
   s1,s2:ansistring;
   s:array[0..10000]of char;
   ch:char;
begin
readln(n);
s1:='';
for a:=1 to n do
 begin
 readln(ch);
 s1:=s1+ch;
 end;
 s2:='';
 sum:=0;
for a:=length(s1) downto 1 do
 s2:=s2+s1[a];
for a:=1 to n do
 begin
 if s1<s2 then
  begin
   inc(sum);
   s[sum]:=s1[1];
   delete(s1,1,1);
   delete(s2,length(s2),1);
  end
  else
  begin
  inc(sum);
  s[sum]:=s2[1];
  delete(s2,1,1);
  delete(s1,length(s1),1);
  end;
 end;
for a:=1 to sum-1 do
 write(s[a]);
 writeln(s[sum]);
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