arrow_forward همه ارسال‌ها

جزئیات ارسال کد#221

code_blocks
مسئله مربوطه: ماراتون پینگ پنگ (#16) arrow_outward
verified
وضعیت داوری نهایی: محدودیت زمان تست 5
terminal
زبان برنامه‌نویسی: Python
schedule
ارسال‌کننده و زمان:
Mujtablue io (۳ سال پیش)
descriptionsolution.py ۳۰ خط • ۷۲۳ بایت
1##def pong(receive: int) -> int:
2## potentialservice = receive - 1
3## for service in range(potentialservice, 0, -1):
4## print(service)
5## if not bool(receive % service):
6## return service
7
8
9from math import sqrt
10
11def pong(receive: int) -> int:
12 potential_services = iter(range(receive - 1, 0, -1))
13 service = next(potential_services)
14 while True:
15 if not bool(receive % service):
16 break
17 service = next(potential_services)
18 return service
19
20
21bounce = 1
22def ping(ball: int, bounce: int) -> int:
23 while ball > 1:
24 bounce += 1
25 ball = pong(ball)
26 return bounce
27
28
29ball = int(input())
30print(ping(ball, bounce))
کد ارسال‌شده برای داوری خودکار هاتکدز UTF-8