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

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

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
9def pong(receive: int) -> int:
10 potential_services = iter(range(receive - 1, 0, -1))
11 service = next(potential_services)
12 while True:
13 if not bool(receive % service):
14 break
15 service = next(potential_services)
16 return service
17
18
19bounce = 1
20def ping(ball: int, bounce: int) -> int:
21 while ball > 1:
22 bounce += 1
23 ball = pong(ball)
24 return bounce
25
26
27ball = int(input())
28print(ping(ball, bounce))
کد ارسال‌شده برای داوری خودکار هاتکدز UTF-8