#include <bits/stdc++.h>
using namespace std;
long long s,cv,a,b;
int main()
{
cin>>s>>cv;
cv=cv/2;
for (a=1; a<=cv/2; a++)
for (b=cv/2+1; b<=cv; b++)
if ((a*b==s) and (a+b==cv))
{
cout<<b<<" "<<a;
return 0;
}
return 0;
}
Đúng 0
Bình luận (1)
Program HOC24;
var s,p: longint;
d,r: integer;
begin
write('Nhap dien tich: '); readln(s);
write('Nhap chu vi: '); readln(p);
for r:=1 to p do
for d:=r to p do
if (r*d=s) and ((r+d)*2=p) then
begin
writeln('Chieu dai la: ',d);
writeln('Chieu rong la: ',r);
break;
end;
readln
end.
Đúng 0
Bình luận (0)