讨论 / 求高人指点
~小耳朵猪~ 2011-10-09 07:37:00
点我顶贴 收藏 删除
我是个新手,不太会编。。。

这个题本以为很简单,结果就得了50分。。

求高人指点

程序代码:

program miyu;

var len1,len2,i,j,k,c,m,num,sum,yu,w:longint;

s1,s2:array[1..100000]of char;

mk:array[1..100000]of longint;

ch:char;

procedure mark(yu:longint);

begin

inc(num);

mk[num]:=yu;

end;

begin

assign(input,'miyu.in');

assign(output,'miyu.out');

reset(input);

rewrite(output);

while not eoln do

begin

read(ch);

inc(i);

s1[i]:=ch;

end;

len1:=i;

i:=0;

readln;

while not eoln do

begin

read(ch);

inc(i);

s2[i]:=ch;

end;

len2:=i;

for i:=1 to len2-len1+1 do

begin

c:=i;m:=i; w:=0;

for j:=1 to len1 do

begin

if s1[j]=s2[c] then inc(w);

inc(c);

end;

if w=len1 then begin

mark(m);inc(sum);

end;

end;

if sum<>0 then begin

writeln(sum);

for i:=1 to num do

writeln(mk[i]);end

else write('There must be something wrong.');

close(input);

close(output);

end.

查看更多回复
提交回复