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

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

code_blocks
مسئله مربوطه: ماراتون پینگ پنگ (#16) arrow_outward
verified
وضعیت داوری نهایی: پاسخ نادرست تست 3
terminal
زبان برنامه‌نویسی: Python
schedule
ارسال‌کننده و زمان:
Ali Ashouri (۱ سال پیش)
descriptionsolution.py ۲۵ خط • ۵۵۹ بایت
1import math
2
3
4def main():
5 number_as_string = input()
6 number = int(number_as_string)
7 root_of_number = math.floor(math.sqrt(number))
8 length_of_sequence = 1
9 divisor = 2
10 while divisor <= root_of_number:
11 if number % divisor == 0:
12 length_of_sequence += 1
13 number = number // divisor
14 else:
15 divisor += 1
16
17 if length_of_sequence == 1:
18 # it means the input number is a prime number
19 print(2)
20 else:
21 print(length_of_sequence)
22
23
24if __name__ == '__main__':
25 main()
کد ارسال‌شده برای داوری خودکار هاتکدز UTF-8