讨论 / 大牛帮帮我,哪里错了?
jerryR1 2011-08-08 07:06:00
点我顶贴 收藏 删除
状态: Unaccepted

测评机: Xeost[5]

得分: 40分

提交日期: 2009-8-8 21:52:00

有效耗时: 235毫秒

测试结果1: 测试结果错误.错误结果为:11

正确结果应为:9

测试结果2: 通过本测试点|有效耗时63ms

测试结果3: 测试结果错误.错误结果为:44

正确结果应为:14

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

正确结果应为:225

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

提交代码: var x,y:array[1..100] of real;

max,a,b,c:real;

i,n:Longint;

function h(a,b,c:real):real;

var p:real;

begin

p:=(a+b+c)/2;

h:=sqrt(p*(p-a)*(p-b)*(p-c));

end;

begin

readln(n);

for i:=1 to n do readln(x[i],y[i]);

for i:=n downto 3 do

begin

a:=sqrt(sqr(x[i]-x[1])+sqr(y[i]-y[1]));

b:=sqrt(sqr(x[i]-x[i-1])+sqr(y[i]-y[i-1]));

c:=sqrt(sqr(x[i-1]-x[1])+sqr(y[i-1]-y[1]));

max:=max+h(a,b,c);

end;

write(max:0:0);

end.

在此先谢过大牛们!

#1 jerryR1@2009-08-08 07:09:00
回复 删除
状态题目:area

题目编号:411-area 查看该题

状态: Unaccepted

测评机: Xeost[5]

得分: 40分

提交日期: 2009-8-8 22:06:00

有效耗时: 328毫秒

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

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

正确结果应为:160000

测试结果3: 测试结果错误.错误结果为:44

正确结果应为:14

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

正确结果应为:225

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

提交代码: var x,y:array[1..100] of real;

max:real;

i,n:Longint;

begin

readln(n);

for i:=1 to n do readln(x[i],y[i]);

for i:=2 to n-1 do

begin

max:=max+0.5*abs(x[1]*y[i+1]+x[i+1]*y[i+2]+x[i+2]*y[1]-x[1]*y[i+2]-x[i+1]*y[1]-x[i+2]*y[i+1]);

end;

write(max:0:0);

end.

两种算法,不一样的结果,同样的分,求教大牛呀!

#2 Fish、のTorres@2009-08-08 07:14:00
回复 删除
orz。。

直接输出样例,20分

#3 jerryR1@2009-08-08 07:32:00
回复 删除
状态题目:area

题目编号:411-area 查看该题

状态: Accepted

测评机: Xeost[5]

得分: 100分

提交日期: 2009-8-8 22:28:00

有效耗时: 375毫秒

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

测试结果2: 通过本测试点|有效耗时62ms

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

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

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

谢谢大牛们的点拨,我已明白怎么错了,前面是凸边形计算方法,还有凹边形。谢谢

#4 suai@2009-08-10 20:44:00
回复 删除
ok

#5 Fish、のTorres@2011-08-08 07:06:00
回复 删除
回复 板凳Fish、のTorres 的帖子

发现我竟然回过这帖子

查看更多回复
提交回复