#include <iostream>
#include <cmath>
using namespace std;
int main() {
float a(-1),b(1),h,x1,x2,y1,y2,k,s(0);
int n(2);
do {
k=s; s=0;
for (int j=1; j<=n; j++) {
h=(b-a)/n;
x1=a+h*(j-1); x2=x1+h;
y1=x1*x1; y2=x2*x2;
s=s+(y1*h+y2*h)/2;
}
n++;
if (abs(s-k)<0.01) {
cout << "1" << endl;
break;
}
}
while(n>=0);
cout << s <<endl << n << endl;
return(0);
}
Var a,b,c,d,sr:real;
begin
read(a,b,c,d);
sr:=(a+b+c+d)/4;
if (a<b) and (b<c) and (c<d) then
begin
a:=d;
b:=d;
c:=d;
end
else
if (a>b) and (b>c) and (c>d) then
begin
a:=sr;
b:=a;
c:=a;
d:=a;
end
else
begin
a*=a;
b*=b;
c*=c;
d*=d;
end;
write(a,' ',b,' ',c,' ',d);
<span>end.</span>
Надеюсь вам можно использовать массивы, если нет, то скажите, переделаем
Ответ:
Если добавить пропущенные пробелы, то верно.
Объяснение:
Можно убедиться в этом, например, так:
Const a:array[1..3]of integer=(13,8,58);
begin
writeln(a[1],' ',a[2],' ',a[3]);
end.
Результат:
13 8 58
a=input()
spisok0=a.split()
spisok1=[]
schet=0
for i in range(len(spisok0)):
print(schet)
print(spisok0)
if int(spisok0[schet]) == 0:
spisok1.append(0)
del spisok0[schet]
schet-=1
schet+=1
print(spisok0,spisok1)