五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網 會員登陸 & 注冊

CF 854A - Fraction

2023-06-28 14:54 作者:您是打尖兒還是住店呢  | 我要投稿

Petya is a big fan of mathematics, especially its part related to fractions. Recently he learned that a fraction? is called proper iff its numerator is smaller than its denominator (a?<?b) and that the fraction is called irreducible if its numerator and its denominator are coprime (they do not have positive common divisors except 1).


During his free time, Petya thinks about proper irreducible fractions and converts them to decimals using the calculator. One day he mistakenly pressed addition button (?+?) instead of division button (÷) and got sum of numerator and denominator that was equal to n instead of the expected decimal notation.


Petya wanted to restore the original fraction, but soon he realized that it might not be done uniquely. That's why he decided to determine maximum possible proper irreducible fraction? such that sum of its numerator and denominator equals n. Help Petya deal with this problem.

----------------------------------------------------

Petya 是數(shù)學的忠實粉絲,尤其是與分數(shù)相關的部分。 最近他了解到,如果一個分數(shù)的分子小于分母(a?<?b),則該分數(shù)被稱為真分數(shù);如果其分子和分母互質(除了 1 之外,它們沒有正公約數(shù)),則該分數(shù)被稱為不可約分數(shù)。


在空閑時間,佩蒂亞思考不可約分數(shù)并使用計算器將其轉換為小數(shù)。 有一天,他錯誤地按了加法按鈕(?+?)而不是除法按鈕(÷),得到的分子和分母之和等于n,而不是預期的小數(shù)符號。


彼佳想要恢復原來的分數(shù),但很快他意識到這可能不是唯一的方法。 這就是為什么他決定確定最大可能的真不可約分數(shù),使其分子和分母之和等于 n。 幫助 Petya 解決這個問題。

-----------------------------------------------

依次遍歷即可,主要是要判斷最大公約數(shù)等于1;

下面是代碼:


CF 854A - Fraction的評論 (共 條)

分享到微博請遵守國家法律
玉龙| 利川市| 衢州市| 宝鸡市| 伊吾县| 柘城县| 乌拉特前旗| 昭觉县| 新乐市| 湘潭市| 惠来县| 铜陵市| 当阳市| 通江县| 南宁市| 赫章县| 湘乡市| 中阳县| 阜平县| 古丈县| 天镇县| 宁晋县| 成都市| 香港 | 阜平县| 醴陵市| 霍林郭勒市| 哈密市| 晋城| 曲靖市| 山西省| 循化| 邮箱| 隆尧县| 南江县| 中江县| 阳原县| 托里县| 长海县| 九寨沟县| 阿克|