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.
#include
float f(float x, float a, float b, float c)
{
float result;
+ 10)< 0) & & (b ! = 0))
{
result = a*x*x + c*x + b;
}
else
{
+ 10) > 0) & & (b ==0))
{
result = (x - a) / (x - c);
}
else
{
result = -x/a - c;
}
}
return result;
}
int main(void)
{
float
x_start = -100,
x_end = 100,
dx = 2,
a = 3,
b = 2,
c = 5;
printf("x\t\t\tf(x)\n");
for(float i = x_start; i < x_end; i += dx)
{
printf("%f\t%f\n", i, f(i, a, b, c));
}
return 0;
}