PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000170. Số lượng ước chung (Number of common divisors)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Số lượng ước chung (Number of common divisors)
Number of common divisors
Source: SPOJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given two positive integers and , a positive integer is a common divisor if both numbers are divisible by . Count the distinct positive common divisors without listing them.
Input
One line containing two positive integers .
Output
Print the number of positive common divisors of and .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
12 24
Output
6
Explanation
The common divisors of and are , giving divisors.