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

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

code_blocks
مسئله مربوطه: ماراتون پینگ پنگ (#16) arrow_outward
verified
وضعیت داوری نهایی: خطای اجرا تست 4 مشاهده لاگ خطا
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 potential_service = not bool(receive % service)
15 while True:
16 service = next(potential_services)
17 potential_service = not bool(receive % service)
18 if potential_service:
19 break
20 return service
21
22
23bounce = 1
24def ping(ball: int, bounce: int) -> int:
25 while ball > 1:
26 bounce += 1
27 ball = pong(ball)
28 return bounce
29
30
31ball = int(input())
32print(ping(ball, bounce))
کد ارسال‌شده برای داوری خودکار هاتکدز UTF-8