3033: 【普及+/提高】【P1621】集合

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:0 解决:0

题目描述

Caima 给你了所有 lns="http://www.w3.org/1998/Math/MathML">[,] 范围内的整数。一开始每个整数都属于各自的集合。每次你需要选择两个属于不同集合的整数,如果这两个整数拥有大于等于 lns="http://www.w3.org/1998/Math/MathML"> 的公共质因数,那么把它们所在的集合合并。

重复如上操作,直到没有可以合并的集合为止。

现在 Caima 想知道,最后有多少个集合。

输入

一行,共三个整数 lns="http://www.w3.org/1998/Math/MathML">,,,用空格隔开。

输出

一个数,表示最终集合的个数。

样例输入 复制

10 20 3

样例输出 复制

7

提示

样例 1 解释

对于样例给定的数据,最后有 lns="http://www.w3.org/1998/Math/MathML">{10,20,12,15,18},{13},{14},{16},{17},{19},{11} 共 lns="http://www.w3.org/1998/Math/MathML">7 个集合,所以输出应该为 lns="http://www.w3.org/1998/Math/MathML">7

数据规模与约定

  • 对于 lns="http://www.w3.org/1998/Math/MathML">80% 的数据,lns="http://www.w3.org/1998/Math/MathML">1103
  • 对于 lns="http://www.w3.org/1998/Math/MathML">100 的数据,lns="http://www.w3.org/1998/Math/MathML">1105,2