var a, b, c, d, x1, x2, t: real; begin writeln('Программа для решения неравенства ax^2 + bx + c > 0'); write('Введите коэффициенты a, b, c: '); readln(a, b, c); if a = 0 then begin if b = 0 then begin if c > 0 then writeln('(-∞; +∞)') else writeln('ø') end else if b > 0 then writeln('(', -c / b : 0 : 3, '; +∞)') else writeln('(-∞; ', -c / b, ')') end else begin d := b * b - 4 * a * c; if d = 0 then begin x1 := -b / (2 * a); if a > 0 then writeln('(-∞; ', x1, ') U (', x1, '; +∞)') else writeln('ø') end else if d > 0 then begin x1 := (-b - sqrt(d)) / (2 * a); x2 := (-b + sqrt(d)) / (2 * a); if x1 > x2 then begin t := x1; x1 := x2; x2 := t end; if a > 0 then writeln('(-∞; ', x1, ') U (', x2, '; +∞)') else writeln('(', x1, '; ', x2, ')') end else begin if a > 0 then writeln('(-∞; +∞)') else writeln('ø') end end end.
var a, b, c, d, x1, x2, t: real; begin writeln('Программа для решения неравенства ax^2 + bx + c > 0'); write('Введите коэффициенты a, b, c: '); readln(a, b, c); if a = 0 then begin if b = 0 then begin if c > 0 then writeln('(-∞; +∞)') else writeln('ø') end else if b > 0 then writeln('(', -c / b : 0 : 3, '; +∞)') else writeln('(-∞; ', -c / b, ')') end else begin d := b * b - 4 * a * c; if d = 0 then begin x1 := -b / (2 * a); if a > 0 then writeln('(-∞; ', x1, ') U (', x1, '; +∞)') else writeln('ø') end else if d > 0 then begin x1 := (-b - sqrt(d)) / (2 * a); x2 := (-b + sqrt(d)) / (2 * a); if x1 > x2 then begin t := x1; x1 := x2; x2 := t end; if a > 0 then writeln('(-∞; ', x1, ') U (', x2, '; +∞)') else writeln('(', x1, '; ', x2, ')') end else begin if a > 0 then writeln('(-∞; +∞)') else writeln('ø') end end end.
#include <cmath>
using namespace std;
double a[3], s = 0;
int main()
{
for(int i = 0 ; i < 3; i++)
{
cin >> a[i];
s += a[i];
}
s /= 3;
for(int i = 0; i < 3; i++)
{
if(fabs(a[i]) > fabs(s))
cout << a[i] << " ";
}
return 0;
}