|
|
back to boardDiscussion of Problem 1020. Ropehalp me please Program NoName; var n,r,i:integer; x: array [1..100] of real; y: array [1..100] of real; s,sg:real; input,output:text; begin s:=0; assign(input, 'input.txt'); reset(input); assign(output, 'output.txt'); rewrite(output); readln(n,r); if n=1 then writeln(1.00)else begin For i:=1 to n do readln(x[i],y[i]); sg:=2*pi*r; For i:=1 to n-1 do s:=s+sqrt(sqr(x[i]-x[i+1])+sqr(y[i]-y[i+1])); s:=s+sqrt(sqr(x[n]-x[1])+sqr(y[n]-y[1])); s:=s+sg; end; writeln(s:1:2); close(input); close(output); end. Re: halp me please First, remove the read and write in the txt files, you need to read/write from/to the console. You'll get WA3 now. Try to re-think the case when n=1; the answer is not always 1! |
|
|