1. Trang chủ
  2. » Vật lí lớp 12

De thi Toan Tin hoc trong nha truong Bai 40

3 11 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 3
Dung lượng 5,7 KB

Nội dung

[r]

(1)

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<>' ') 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]) inc(i); XdToado:=i;

End;

Procedure InputDen; Var i:integer;

Begin

(2)

Readln(f,n); For i:=1 to n 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 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 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

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]);

(3)

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;

Ngày đăng: 05/03/2021, 13:20

w