你从一个连续整数序列开始,想要将它们分组到不同的集合中。
给定一个区间 $[A, B]$ 和一个整数 $P$。最初,区间中的每个数字都各自属于一个集合。
接着,考虑区间内的每一对整数。如果这两个整数共享一个至少为 $P$ 的质因数,则将这两个整数所属的集合合并。
请问在这一过程结束时,总共有多少个不同的集合?
样例
输入格式 1
2 10 20 5 10 20 3
输出格式 1
Case #1: 9 Case #2: 7
你从一个连续整数序列开始,想要将它们分组到不同的集合中。
给定一个区间 $[A, B]$ 和一个整数 $P$。最初,区间中的每个数字都各自属于一个集合。
接着,考虑区间内的每一对整数。如果这两个整数共享一个至少为 $P$ 的质因数,则将这两个整数所属的集合合并。
请问在这一过程结束时,总共有多少个不同的集合?
2 10 20 5 10 20 3
Case #1: 9 Case #2: 7
The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.
This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.
If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.
Guidelines: