var a: array[1..100] of real; i, n, j, count: integer; sum: real;
begin {ввод массива} if handsfree then n := random(20) + 5 else begin write('n = '); readln(n); end;
writeln('Данные массива:'); for i := 1 to n do begin if handsfree then begin a[i] := (random(10) - 5) * 0.5; write(a[i], ' '); end else readln(a[i]); end; writeln();
{подсчет суммы и кол-ва} sum := 0; count := 0; for i := 1 to n do begin if a[i] < 0 then sum := sum + a[i]; if a[i] = 0.5 then count := count + 1; end; writeln('count = ', count); writeln('sum = ', sum); end.
c++
#include <iostream>
using namespace std;
int main()
{
int a, b, c, d, e;
cin >> a >> b >> c >> d >> e;
if (a <= d and b <= e or a <= e and b <= d) {
cout << "YES";
}
else if (c <= d and b <= e or c <= e and b <= d) {
cout << "YES";
}
else if (c <= d and a <= e or c <= e and a <= d) {
cout << "YES";
}
else {
cout << "NO";
}
return 0;
}
python
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
if a <= d and b <= e or a <= e and b <= d:
print("YES")
elif c <= d and b <= e or c <= e and b <= d:
print("YES")
elif c <= d and a <= e or c <= e and a <= d:
print("YES")
else:
print("NO")
Объяснение:
handsfree = true;
var
a: array[1..100] of real;
i, n, j, count: integer;
sum: real;
begin
{ввод массива}
if handsfree then
n := random(20) + 5
else begin
write('n = ');
readln(n);
end;
writeln('Данные массива:');
for i := 1 to n do
begin
if handsfree then begin
a[i] := (random(10) - 5) * 0.5;
write(a[i], ' ');
end
else readln(a[i]);
end;
writeln();
{подсчет суммы и кол-ва}
sum := 0;
count := 0;
for i := 1 to n do
begin
if a[i] < 0 then
sum := sum + a[i];
if a[i] = 0.5 then
count := count + 1;
end;
writeln('count = ', count);
writeln('sum = ', sum);
end.