讨论 / 【破碎的项链】为什么70分???
mcm_noip 2010-07-07 07:47:00
点我顶贴 收藏 删除
为什么70分??

错哪里了??

谁给个测试数据

状态: Unaccepted

测评机: Xeost[5]

得分: 70分

提交日期: 2010-7-3 17:35:00

有效耗时: 469毫秒

测试结果1: 通过本测试点|有效耗时188ms

测试结果2: 测试结果错误.错误结果为:5

正确结果应为:3

测试结果3: 通过本测试点|有效耗时47ms

测试结果4: 测试结果错误.错误结果为:52

正确结果应为:17

测试结果5: 通过本测试点|有效耗时46ms

测试结果6: 测试结果错误.错误结果为:12

正确结果应为:8

测试结果7: 通过本测试点|有效耗时47ms

测试结果8: 通过本测试点|有效耗时47ms

测试结果9: 通过本测试点|有效耗时47ms

测试结果10: 通过本测试点|有效耗时47ms

var n,max,i,j,k,a,len:integer;

l:array[0..350]of integer;

s:ansistring;

procedure up(i:integer);

begin

if i>len then i:=1;

if i=k then exit;

if (s[i]<>s[a])and(s[i]<>'w') then exit;

if (s[i]=s[a])or (s[i]='w')then inc(l[k]);

up(i+1);

end;

procedure down(i:integer);

begin

if j<=0 then j:=len;

if i<=0 then i:=len;

if i=k then exit;

if (s[i]<>s[j])and(s[i]<>'w') then exit;

if (s[i]=s[j])or (s[i]='w')then inc(l[k]);

down(i-1);

end;

{main}

begin

readln(n);

readln(s);

for i:=1 to n do

l[i]:=2;

len:=length(s);

for k:=1 to n do

begin

a:=k;

j:=k-1;

if j=0 then j:=len;

while s[j]='w' do

begin

dec(j);

inc(l[k]);

end;

while s[a]='w' do

begin

inc(a);

inc(l[k]);

end;

up(a+1);

down(j-1);

end;

for i:=1 to n do

if l[i]>max then max:=l[i];

writeln(max);

end.

#1 zsz2009@2010-07-03 03:50:00
回复 删除
去 nocow 上看看~~
#2 noip2012@2010-07-07 07:47:00
回复 删除
var

a:array[1..350] of char;

n,i,j,s,max:integer;

t:char;

begin

readln(n);

for i:=1 to n do read(a[i]);

readln;

max:=-maxint;

for i:=1 to n do

begin

s:=0;

j:=i-1;

if j=0 then j:=n;

while (a[j]='w')and(s<n) do

begin

inc(s);

dec(j);

if j=0 then j:=n;

end;

t:=a[j];

while ((a[j]=t)or(a[j]='w'))and(s<n) do

begin

inc(s);

dec(j);

if j=0 then j:=n;

end;

j:=i;

while (a[j]='w')and(s<n) do

begin

inc(s);

inc(j);

if j=n+1 then j:=1;

end;

t:=a[j];

while ((a[j]=t)or(a[j]='w'))and(s<n) do

begin

inc(s);

inc(j);

if j=n+1 then j:=1;

end;

if s>max then max:=s;

end;

writeln(max);

end.

本程序AC

查看更多回复
提交回复