Đề thi Toán - Tin học trong nhà trường (Bài 40)

Chia sẻ bởi Thân Thị Thanh | Ngày 18/10/2018 | 59

Chia sẻ tài liệu: Đề thi Toán - Tin học trong nhà trường (Bài 40) thuộc Sinh học 6

Nội dung tài liệu:

Bài 40/2000 - Máy định vị Radio
Uses crt;
Const nmax = 30;
Output = `P27.out`;
Input = `P27.inp`;
Type
str20 = string[20];
Var
Toado : Array[1..nmax,1..2] of real;
TenDen,TenDen1,TenDen2 : Array[1..nmax] of str20;
n,j,i,k:integer;
Td1,Td2:array[1..2] of integer;
goc,g1,g2,v,l:array[1..2] of real;
t1,t2:array[1..2] of integer;
xd,yd,x,y, x1,x2,y1,y2:array[1..2] of real;
f:text;
Function tg(x: real): real;
Begin
if cos(x)<>0 then tg:=sin(x)/cos(x);
End;
Procedure DocDen(var s:str20);
Var d:char;
Begin
repeat
read(f,d);
Until (d<>` `);
s:=``;
While (d<>` `) do
begin
s:=s+d;
Read(f,d);
End;
End;
Function XdToado(s:str20):Integer;
Var i:integer;
Begin
i:=1;
While (i<=n) and (s<> tenden[i]) do inc(i);
XdToado:=i;
End;

Procedure InputDen;
Var i:integer;
Begin
Assign(f,input);
Reset(f);
Readln(f,n);
For i:=1 to n do
Begin
DocDen(TenDen[i]);
Readln(f,Toado[i,1],Toado[i,2]);
End;
End;
Procedure Inputkichban;
Begin
Readln(f,k);
For i:=1 to k do
Begin
Readln(f, goc[i],v[i]);
Read(f,t1[i]);
Docden(tenden1[i]);
Td1[i]:=Xdtoado(tenden1[i]);
Readln(f,g1[i]);
Read(f,t2[i]);
Docden(tenden2[i]);
Td2[i]:=Xdtoado(tenden2[i]);
Readln(f,g2[i]);
End;
Close(f);
End;
Procedure Doi;
Begin
For j:=1 to k do
Begin
goc[j]:=goc[j]*pi/180;
g1[j]:=g1[j]*pi/180;
g2[j]:=g2[j]*pi/180;
l[j]:=(t2[j]-t1[j])*v[j];
End;
End;
Procedure TinhToan;
Begin
Assign(f,output);Rewrite(f);
For j:=1 to k do
Begin
x1[j]:=Toado[td1[j],1];
y1[j]:=Toado[td1[j],2];
x2[j]:=Toado[td2[j],1];
y2[j]:=Toado[td2[j],2];
xd[j]:=x1[j]+l[j]*sin(goc[j]);
yd[j]:=y1[j]+l[j]*cos(goc[j]);
If (cos(goc[j]+g2[j])=0) or (cos(goc[j]+g1[j])=0) then
Writeln(f,`Scenario `,j,`: Position cannot be determined`)
else
Begin
y[j]:= (xd[j] - x2[j] - yd[j]*tg(goc[j] + g1[j]) + y2[j]*tg(goc[j] + g2[j]))/(tg(goc[j] + g2[j]) - tg(goc[j] + g1[j]));
x[j]:= x2[j] - (y2[j] - y[j])*tg(goc[j] + g2[j]);
Writeln(f,`Scenario `,j,`: Positino is (`, x[j]:6:2, y[j]:6:2,`)`) ;
end;
End;
End;
BEGIN
InputDen;
Inputkichban;
Doi;
TinhToan;
Close(f);
* Một số tài liệu cũ có thể bị lỗi font khi hiển thị do dùng bộ mã không phải Unikey ...

Người chia sẻ: Thân Thị Thanh
Dung lượng: | Lượt tài: 0
Loại file:
Nguồn : Chưa rõ
(Tài liệu chưa được thẩm định)