Python 3.6
a = [int(i) for i in input().split()]
ab = abs(a[1] - a[2])
if ab > 180:
ab = 360 - ab
if ab % a[4] == 0:
x = ab // a[4]
else:
x = ab // a[4] + 1
if a[0] % a[3] == 0:
x += a[0] // a[3]
x += a[0] // a[3] + 1
print(x)
PascalABC.NET 3.5.1
program who;
var a, b, ab, t: integer;
d, s, x: LongInt;
begin
read(d, a, b, s, t);
ab := abs(a - b);
if ab > 180 then
ab := 360 - ab;
if ab mod t = 0 then
x := ab div t
else
x := ab div t + 1;
if d mod s = 0 then
x := x + d div s
x := x + d div s + 1;
write(x);
end.
Объяснение:
Думаю по коду поймешь
не так уж и трудно, если
program project2;
var
n,a,b,c,i,k,max,min: longint;
inp,outp: text;
assign(inp,'input.txt');
reset(inp);
assign(outp,'output.txt');
rewrite(outp);
readln(inp,n);
max: =0;
min: =0;
c: =0;
for i: =1 to n do
read(f1,a);
if i=1 then
b: =a;
if a> max then
max: =a;
k: =a-c;
c: =a;
if k< 0 then
k: =abs(k);
min: =min+k;
if k> min then
min: =k;
end;
max: =max-b;
write(outp,max,' ',min);
close(inp);
close(outp);
Python 3.6
a = [int(i) for i in input().split()]
ab = abs(a[1] - a[2])
if ab > 180:
ab = 360 - ab
if ab % a[4] == 0:
x = ab // a[4]
else:
x = ab // a[4] + 1
if a[0] % a[3] == 0:
x += a[0] // a[3]
else:
x += a[0] // a[3] + 1
print(x)
PascalABC.NET 3.5.1
program who;
var a, b, ab, t: integer;
d, s, x: LongInt;
begin
read(d, a, b, s, t);
ab := abs(a - b);
if ab > 180 then
ab := 360 - ab;
if ab mod t = 0 then
x := ab div t
else
x := ab div t + 1;
if d mod s = 0 then
x := x + d div s
else
x := x + d div s + 1;
write(x);
end.
Объяснение:
Думаю по коду поймешь
не так уж и трудно, если
program project2;
var
n,a,b,c,i,k,max,min: longint;
inp,outp: text;
begin
assign(inp,'input.txt');
reset(inp);
assign(outp,'output.txt');
rewrite(outp);
readln(inp,n);
max: =0;
min: =0;
c: =0;
for i: =1 to n do
begin
read(f1,a);
if i=1 then
b: =a;
if a> max then
max: =a;
k: =a-c;
c: =a;
if k< 0 then
begin
k: =abs(k);
min: =min+k;
if k> min then
min: =k;
end;
end;
max: =max-b;
write(outp,max,' ',min);
close(inp);
close(outp);
end.