06.12.2010, 00:39
|
Прохожий
|
|
Регистрация: 04.12.2010
Сообщения: 20
Репутация: 10
|
|
вот:
Код:
program bisqr;
{$APPTYPE CONSOLE}
uses
SysUtils;
var a,b,c,d,x1,x2,x3,x4,p1,p2:real;
i,j:Integer;
begin
Reset(Input,'bisqr.in');
Rewrite(Output,'bisqr.out');
read(a,b,c);
x1:=-3333;x2:=-3333;x3:=-3333;x4:=-3333;
if (a=0)and(b=0) and (c=0) then writeln(-1);
if (a<>0) and (b<>0) and (c=0) then begin
Writeln(1);
Writeln(0);
end;
if (a<>0) and (b=0) and (c=0) then begin
Writeln(1);
Writeln(0);
end;
if (a=0) and (b=0) and (c<>0) then begin
Writeln(0);
end;
if (a=0) and (b<>0) and (c<>0) then begin
Writeln(0);
end;
if (a=0) and (b<>0) and (c=0) then begin
Writeln(1);
Writeln(0)
end;
if (a<>0) and (b=0) and (c<>0) then begin
Writeln(0);
end;
if (a<>0)and(b<>0) and (c<>0)then begin
x1:=-3333;x2:=-3333;x3:=-3333;x4:=-3333;
if (b*b - 4*a*c) > 0 then begin
d:=b*b - 4*a*c ;
p1:=-(b+sqrt(D))/(2*a);
p2:=-(b-sqrt(D))/(2*a);
i:=0;
if p1>0 then begin x1:=Sqrt(p1);x2:=-x1;i:=i+2;end;
if p2>0 then begin x3:=Sqrt(p2);x4:=-x3; i:=i+2; end;
Writeln(i);
if x1<>-3333 then Writeln(x1:0:6);
if x2<>-3333 then Writeln(x2:0:6);
if x3<>-3333 then Writeln(x3:0:6);
if x4<>-3333 then Writeln(x4:0:6);
end;
if (b*b - 4*a*c) = 0 then begin p1:=-b/(2*a);
i:=0;
if p1>0 then begin x1:=Sqrt(p1); x2:=-x1;i:=2;end;
Writeln(i);
if x1<>-3333 then Writeln(x1:0:6);
if x2<>-3333 then Writeln(x2:0:6);
end;
if (b*b - 4*a*c) < 0 then Writeln(0);
end;
//Writeln(i);
//write(x1:0:6,' ',x2:0:6);
CloseFile(Output);
end.
но тут где то есть ошибка...вот только где....
сначала выводится количество ответов, потомсами решения
|