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

哪位大侠能不能给点数据或提示阿,测试数据我都能通过,可还是Wa

Posted by fatheadfish at 2005-06-02 16:57:34 on Problem 1016
var
 s:array[-2..25] of string;
 a,b,c,d,e,f,g,x:longint;
procedure zh(var sx,sy:string);
 var
  m,n,i,j,t:longint;
  ch1,ch2:string;
  num:array[0..10] of integer;
 begin
  ch1:='';ch2:='';m:=0;n:=0;i:=0;j:=0;t:=0;
  for i:=0 to 10 do num[i]:=0;
  for i:=1 to length(sx) do
   begin
    val(sx[i],t);
    num[t]:=num[t]+1;
   end;
  for i:=0 to 9 do
   begin
    if num[i]<>0 then
     begin
      str(num[i],ch1);str(i,ch2);
      sy:=sy+ch1+ch2;
     end;
   end;
 end;
function fuhetiaojian(sx:string):boolean;
 var
  i,j:longint;
 begin
  i:=0;j:=0;
  fuhetiaojian:=false;
  if s[1]=s[0] then
   begin
    writeln(s[0],' is self-inventorying');
    fuhetiaojian:=true;
    exit;
   end;
  if x>17 then
   begin
    writeln(s[0],' can not be classified after 15 iterations');
    fuhetiaojian:=true;
    exit;
   end;
  if (s[x-1]=s[x-2]) and (x>2) then
   begin
    writeln(s[0],' is self-inventorying after ',(x-2),' steps');
    fuhetiaojian:=true;
    exit;
   end;
  for i:=0 to x-2 do
  if (s[x-1]=s[i]) and (x>1) then
   begin
    writeln(s[0],' enters an inventory loop of length ',x-1-i);
    fuhetiaojian:=true;
    exit;
   end;
 end;
begin
 while not(s[0]='-1') do
  begin
   for x:=0 to 20 do s[x]:='';
   read(s[0]);readln;x:=1;
   while not(fuhetiaojian(s[x])) do
    begin
     zh(s[x-1],s[x]);
     x:=x+1;
    end;
  end;
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