状态: Accepted
测评机: Xeost[5]
得分: 100分 [我要评价一下题目~]
提交日期: 2012-7-13 11:39:00
有效耗时: 2546毫秒
测试结果1: 通过本测试点|有效耗时187ms
测试结果2: 通过本测试点|有效耗时63ms
测试结果3: 通过本测试点|有效耗时156ms
测试结果4: 通过本测试点|有效耗时172ms
测试结果5: 通过本测试点|有效耗时172ms
测试结果6: 通过本测试点|有效耗时203ms
测试结果7: 通过本测试点|有效耗时203ms
测试结果8: 通过本测试点|有效耗时484ms
测试结果9: 通过本测试点|有效耗时406ms
测试结果10: 通过本测试点|有效耗时500ms
提交代码: view sourceprint?01.program yx;
02.var i,j,k,l,t:longint;
03.
s,p,z,x,s1:ansistring;
04.
05.
06.begin
07.
08.
09.readln(s1);
10.readln(s);
11.
for i:=1 to length(s1) do
12.
s1[i]:=upcase(s1[i]);
13.
for i:=1 to length(s) do
14.
s[i]:=upcase(s[i]);
15.
16.k:=length(s1);
17.
for i:=1 to length(s) do
18.
if(copy(s,i,k)=s1)and(s[i+k]=' ')and(s[i-1]=' ') then
19.
inc(t);
20.
for i:=1 to length(s) do
21.
if(copy(s,i,k)=s1)and(s[i+k]=' ')and(s[i-1]=' ') then
22.
begin
23.
l:=i;
24.
break;
25.
end;
26.
{ p:='';
27.
for i:=1 to length(s) do
28.
if s[i]<>' ' then p:=p+s[i]
29.
else
30.
begin
31.
if p=s1 then inc(t);
32.
p:='';
33.
end;}
34.if t=0 then
35.
write('-1')
36.else
37.
write(t,' ',l-1);
38.end.
39.
40.
end.
样例1却过不去,各位大神,帮忙看看吧!!!!!!