--- Python 3.8.3 ---
import typing
from typing import Callable
from typing import AnyStr
from typing import Any
from typing import Iterable
from typing import List
def SeqCount(Seq: Iterable[Any], predicate: Callable[[Any], bool]) -> int:
counter = 0
for item in Seq:
if predicate(item):
counter+=1
return counter
def main():
n = int(input())
Seq = list(map(int, input().split(maxsplit = n)))
print(SeqCount(Seq, lambda item: item < n))
if __name__ == "__main__":
main()
Проходит предложенный вами тест + пару придуманных лично мной
формат ввода ([Enter] - пользователь нажимает кнопку ввода. ">>>" - вывод программы):
5 [Enter]
-10 4 10 5 2 [Enter]
>>> 3
Код ко второй и восьмой задачам:
{2-nd task}
var t,p,x,a,y: real;
begin
write('t = ');
readln(t);
write('p = ');
readln(p);
write('x = ');
readln(x);
write('a = ');
readln(a);
y:= (exp(ln(t)*p))*(exp(ln(x)*5))*(1 - (x - (exp(ln(a)*x)))/((exp(ln(x)*2)) + 5.3));
writeln('y = ',y:0:2);
end.
{8-th task}
var x,a,y,b,r,q,d: real;
write('y = ');
readln(y);
write('b = ');
readln(b);
write('r = ');
readln(r);
write('q = ');
readln(q);
write('d = ');
readln(d);
x:= ((exp(ln(cos(y))*a)) - (exp(ln((sin(exp(ln(r)*8*q*b)))/((exp(ln(d)*(2*a*b))) + 18.31);
writeln('x = ',x:0:2);
--- Python 3.8.3 ---
import typing
from typing import Callable
from typing import AnyStr
from typing import Any
from typing import Iterable
from typing import List
def SeqCount(Seq: Iterable[Any], predicate: Callable[[Any], bool]) -> int:
counter = 0
for item in Seq:
if predicate(item):
counter+=1
return counter
def main():
n = int(input())
Seq = list(map(int, input().split(maxsplit = n)))
print(SeqCount(Seq, lambda item: item < n))
if __name__ == "__main__":
main()
Проходит предложенный вами тест + пару придуманных лично мной
формат ввода ([Enter] - пользователь нажимает кнопку ввода. ">>>" - вывод программы):
5 [Enter]
-10 4 10 5 2 [Enter]
>>> 3
Код ко второй и восьмой задачам:
{2-nd task}
var t,p,x,a,y: real;
begin
write('t = ');
readln(t);
write('p = ');
readln(p);
write('x = ');
readln(x);
write('a = ');
readln(a);
y:= (exp(ln(t)*p))*(exp(ln(x)*5))*(1 - (x - (exp(ln(a)*x)))/((exp(ln(x)*2)) + 5.3));
writeln('y = ',y:0:2);
end.
{8-th task}
var x,a,y,b,r,q,d: real;
begin
write('a = ');
readln(a);
write('y = ');
readln(y);
write('b = ');
readln(b);
write('r = ');
readln(r);
write('q = ');
readln(q);
write('d = ');
readln(d);
x:= ((exp(ln(cos(y))*a)) - (exp(ln((sin(exp(ln(r)*8*q*b)))/((exp(ln(d)*(2*a*b))) + 18.31);
writeln('x = ',x:0:2);
end.