CF 1764B - Doremy's Perfect Math Class
"Everybody! Doremy's Perfect Math Class is about to start! Come and do your best if you want to have as much IQ as me!" In today's math class, Doremy is teaching everyone subtraction. Now she gives you a quiz to prove that you are paying attention in class.
You are given a set S containing positive integers. You may perform the following operation some (possibly zero) number of times:
choose two integers x and y from the set S such that x>y and x−y
is not in the set S.add x−y into the set S.
You need to tell Doremy the maximum possible number of integers in S if the operations are performed optimally. It can be proven that this number is finite.
-------------------------------------------------------------------------------
“大家!多蕾米完美数学课即将开始!如果你们想拥有和我一样高的智商,就来加油吧!” 今天的数学课,Doremy正在教大家减法。 现在她给你一个测验来证明你在课堂上专心听讲。
给定一个包含正整数的集合 S。 您可以执行以下操作几次(可能为零):
从集合 S 中选择两个整数 x 和 y,使得 x>y 且 x−y
不在集合 S 中。将 x−y 添加到集合 S 中。
如果运算执行最佳,您需要告诉 Doremy S 中可能存在的最大整数个数。 可以证明这个数是有限的。
---------------------------------------
其实就是求最大公约数的,因为确定了最大公约数,那么最大值除以最大公约数就是所有可能的数的个数;
只是最大公约数的代码一开始搞错了,,,汗颜啊;