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

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

code_blocks
مسئله مربوطه: ماراتون پینگ پنگ (#16) arrow_outward
verified
وضعیت داوری نهایی: محدودیت زمان تست 5
terminal
زبان برنامه‌نویسی: Python
schedule
ارسال‌کننده و زمان:
Mujtablue io (۳ سال پیش)
descriptionsolution.py ۲۰ خط • ۴۶۶ بایت
1bounce = 1
2ball = int(input())
3
4
5while ball > 1:
6 if (ball / 2).is_integer():
7 bounce += 1
8 ball = int(ball / 2)
9 else:
10 potential_services = iter(range(ball - 1, 0, -1))
11 service = next(potential_services)
12 while True:
13 if not bool(ball % service):
14 bounce += 1
15 ball = service
16 break
17 service = next(potential_services)
18
19
20print(bounce)
کد ارسال‌شده برای داوری خودکار هاتکدز UTF-8