Python
n=int(input('Введите кол-во элементов массива : '))
a = list(map(int, input().split()))
print(sum(map(lambda item: item < 0, a)))
import math
p = int(
b = false
for i in range(1, p ** 2):
gip = (p ** 2) + (i ** 2)
if math.sqrt(gip) % 1 == 0:
b = true
if int(math.sqrt(gip)) ! = p:
print(int(math.sqrt(
if b == false:
print(-1)
# что-то типо этого, но не проходит по времени. надо смотреть диапазон. может если кто дорешает, ответьте. а так всё норм работает)
для твоего образца.
function cat(name, age) {
this.excuses = ['пнх', 'схб' /*здесь можно написать отмазы ленивого кота*/];
this.name = name;
this.age = age;
this.прыжков = 0;
}
cat.prototype = {
sayhello: function () { console.log("hello! my name is " + this.name); },
jump: function (height) {
if (this.прыжков > 3) console.log(this.excuses[math.random() * this.excuses.length | 0]);
else console.log(height > this.age ? "nonono i'm too young. bro! " : "jump");
this.прыжков++;
}
};
n = int(input("Array size: "))
a = list(map(int, input("Array elements: ").split()))
cnt = 0
for i in a:
if i < 0:
cnt += 1
print("There are " + str(cnt) + " negative elements in the given array")