begin
var N, A, B, C, D: integer;
Readln(N, A, B, C, D);
if A > C then (A, B, C, D) := (C, D, B, A);
var s := 1.To(A - 1);
if B < C then // ( ) [ ]
s := s + B.Downto(A) + (B + 1).To(C - 1) +
D.Downto(C) + (D + 1).To(N)
else
if D < B then // ( [ ] )
s := s + SeqGen(C - A, t -> B - t) +
SeqGen(D - C + 1, t -> t + A + B - D) +
SeqGen(B - D, t -> A - t + B - D - 1) + (B + 1).To(N)
end
else // ( [ ) ]
SeqGen(D - B, t -> D - t) + SeqGen(B - C + 1, t -> A + t) +
(D + 1).To(N);
end;
s.Println;
end.
x
2
+
y
=
16
...
.
(
1
)
x + y = 4 (2)
rearrange (2) to y = 4 - x (could do x = 4 - y )
substitute y = 4 - x into (1)
hence:
4
−
⇒
8
and
0
factor and solve : 2x(x - 4 ) = 0
,
substitute these values into y = 4 - x , to find corresponding values of y.
x = 0 : y = 4 - 0 = 4 → (0 , 4)
x = 4 : y = 4 - 4 = 0 → (4 , 0 )
These are the points of intersection with the line x +y = 4 and the circle
Answer link
Объяснение:
begin
var N, A, B, C, D: integer;
Readln(N, A, B, C, D);
if A > C then (A, B, C, D) := (C, D, B, A);
var s := 1.To(A - 1);
if B < C then // ( ) [ ]
s := s + B.Downto(A) + (B + 1).To(C - 1) +
D.Downto(C) + (D + 1).To(N)
else
if D < B then // ( [ ] )
begin
s := s + SeqGen(C - A, t -> B - t) +
SeqGen(D - C + 1, t -> t + A + B - D) +
SeqGen(B - D, t -> A - t + B - D - 1) + (B + 1).To(N)
end
else // ( [ ) ]
begin
s := s + SeqGen(C - A, t -> B - t) +
SeqGen(D - B, t -> D - t) + SeqGen(B - C + 1, t -> A + t) +
(D + 1).To(N);
end;
s.Println;
end.
x
2
+
y
2
=
16
...
...
...
...
...
...
.
.
(
1
)
x + y = 4 (2)
rearrange (2) to y = 4 - x (could do x = 4 - y )
substitute y = 4 - x into (1)
hence:
x
2
+
(
4
−
x
)
2
=
16
⇒
x
2
+
16
−
8
x
+
x
2
=
16
and
2
x
2
−
8
x
+
16
−
16
=
0
⇒
2
x
2
−
8
x
=
0
factor and solve : 2x(x - 4 ) = 0
⇒
x
=
0
,
x
=
4
substitute these values into y = 4 - x , to find corresponding values of y.
x = 0 : y = 4 - 0 = 4 → (0 , 4)
x = 4 : y = 4 - 4 = 0 → (4 , 0 )
These are the points of intersection with the line x +y = 4 and the circle
x
2
+
y
2
=
16
Answer link
Объяснение: