| ||||||||||
| 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 | |||||||||
哪位大侠能不能给点数据或提示阿,测试数据我都能通过,可还是Wavar
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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator