- 失落的成绩单
- 2015-10-27 21:53:56 @
type fzh=record
x,y,z:extended;
end;
var n,m,i:longint;
s:array[0..65] of fzh;
d,d1,d2:real;
a:array[0..65] of extended;
begin
readln(n,m);
readln(d,d1,d2);
a[1]:=d1;a[n]:=d2;
s[3].x:=1;s[3].y:=-2;s[3].z:=2;
s[4].x:=-2;s[4].y:=5;s[4].z:=-4;
for i:=3 to n-1 do
begin
s[i+1].x:=(s[i-1].x)-(2*(s[i].x));
s[i+1].y:=(s[i-1].y)-(2*(s[i].y));
s[i+1].z:=(s[i-1].z)-(2*(s[i].z))+2;
end;
a[2]:=(a[n]-((s[n].x)*a[1])-((s[n].z)*d))/(s[n].y);
a[m]:=((s[m].x)*a[1])+((s[m].y)*a[2])+((s[m].z)*d);
if (m<1) or (m>n) then
begin
writeln('0.000');
halt;
end;
writeln(a[m]:0:3);
end.
2 条评论
-
我是神 LV 10 @ 2016-11-16 14:16:55
我是C++,帮不了你!!!
-
2015-10-29 15:13:38@
No Why
program P1151;
var
b:array[1..60] of real;
t:array[1..60,1..2] of real;
i,n,m:longint;
d,ans:real;
begin
//assign(input,'input.in');
//reset(input);
readln(n,m);
if m=0 then
begin
writeln(0.000:0:3);
halt;
end;
readln(d,b[1],b[n]);
b[1]:=b[1]-d;
b[n]:=b[n]-d;
t[1,1]:=1; t[1,2]:=0;
t[2,1]:=0; t[2,2]:=1;
for i:=3 to n do
begin
t[i,1]:=t[i-2,1]+(-2)*t[i-1,1];
t[i,2]:=t[i-2,2]+(-2)*t[i-1,2];
end;
b[2]:=(b[n]-b[1]*t[n,1])/t[n,2];
for i:=3 to m do
b[i]:=b[i-2]-2*b[i-1];
ans:=b[m]+d;
writeln(ans:0:3);
//close(input);
end.
- 1