PHÂN SỐ NHỎ NHẤT

View as PDF

Submit solution

Points: 100.00 (partial)
Time limit: 1.0s
Memory limit: 512M
Input: stdin
Output: stdout

Problem type
Allowed languages
Python, Scratch

In case the statement didn't load correctly, you can download the statement here: Statement


Comments

Please read the guidelines before commenting.



  • 0
    trungkien5ant   commented on April 17, 2025, 8:25 p.m.

    def gcd(a, b): if b==0: return a else: return gcd(b, a%b)

    if name=='main': a, b, c=int(input()), int(input()), int(input()) ts, ms=min(a, b, c), max(a, b, c) div=gcd(ts, ms) ts//=div; ms//=div print(ts+ms)


  • 0
    trungkien5ant   commented on April 17, 2025, 8:25 p.m.

    def gcd(a, b): if b==0: return a else: return gcd(b, a%b)

    if name=='main': a, b, c=int(input()), int(input()), int(input()) ts, ms=min(a, b, c), max(a, b, c) div=gcd(ts, ms) ts//=div; ms//=div print(ts+ms)


  • 0
    Le_Kiet14   commented on April 16, 2025, 8:24 p.m.

    Code python nè:

    def ucln(a, b): while b: a, b = b, a % b return a ds=[] for _ in range(3): ds.append(int(input()))

    phansonhonhat = float('inf') tusonhonhat = -1 mausonho_nhat = -1

    for i in range(3): for j in range(3): if i != j: tuso = ds[i] mauso = ds[j] giatriphanso = tuso / mau_so

            if gia_tri_phan_so < phan_so_nho_nhat:
                phan_so_nho_nhat = gia_tri_phan_so
                tu_so_nho_nhat = tu_so
                mau_so_nho_nhat = mau_so
    

    uocchung = ucln(tusonhonhat, mausonhonhat) tusorutgon = tusonhonhat // uocchung mausorutgon = mausonhonhat // uoc_chung

    print(tusorutgon + mausorutgon)


  • 0
    khainguyen5d   commented on April 12, 2025, 9:14 a.m.

    AI CÓ CODE scrach ko


  • 0
    quan5a5   commented on April 10, 2025, 2:51 p.m.

    cho mình xin


  • 0
    quan5a5   commented on April 10, 2025, 2:50 p.m.

    ai có bài làm scratch ko


  • 0
    trungcutevip   commented on April 8, 2025, 9:19 p.m.

    Tìm số bé nhất và số lớn nhất,rút gọn rồi cộng lại là xong.


  • 0
    khanhs_2k14   commented on April 8, 2025, 4:27 p.m.

    phân số bé nhất luôn là số bé nhất/số lớn nhất


  • 2
    Kkienbombom2014   commented on March 26, 2025, 7:44 p.m. edited

    mesiuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu


  • 1
    duy_khanh_2k7   commented on Feb. 20, 2025, 8:45 p.m.

    Nếu phải sắp xếp các số thành các phân số khác nhau rồi tìm một phân số nhỏ nhất có thể, vậy thì thay vào đó phải tìm tử số nhỏ nhất và mẫu số lớn nhất trong các số đó (tử số càng nhỏ hoặc mẫu số càng lớn thì phân số càng nhỏ và ngược lại)

    from math import gcd
    a, b, c = [int(input()) for _ in range(3)]
    tu_so = min(a, b, c)
    mau_so = max(a, b, c)
    uoc_chung = gcd(tu_so, mau_so)
    print(tu_so//uoc_chung + mau_so//uoc_chung)
    

  • 2
    KVMB23A_67   commented on Sept. 26, 2024, 11:32 p.m.

    code python đây nhé ACE

    def gcd(a, b):
        if b==0: return a
        else: return gcd(b, a%b)
    
    if __name__=='__main__':
        a, b, c=int(input()), int(input()), int(input())
        ts, ms=min(a, b, c), max(a, b, c)
        div=gcd(ts, ms)
        ts//=div; ms//=div
        print(ts+ms)
    

  • 1
    tn   commented on July 2, 2024, 10:53 p.m. edited

    code nay se ko chay nhanh tai math la thu vien tu C nhung ma mo ta ro hon ve tt Euclid : def _gcd(f1, f2): if f2: return _gcd(f2, f1 % f2) return f1

    a = int(input()) b = int(input()) c = int(input()) m=min(a,b,c) mx=max(a,b,c) c=_gcd(m,mx) print(m//c+mx//c)


  • 1
    SK23A_32   commented on June 29, 2024, 12:39 p.m.

    code nè mọi người: import math a=int(input()) b=int(input()) c=int(input()) ts=min(a,b,c) ms=max(a,b,c) k=math.gcd(ts,ms) ts=ts//k ms=ms//k print(ts+ms)


  • 1
    dangkhoi162013   commented on June 8, 2024, 1:23 p.m.

    tìm số bé nhất và lớn nhất rồi rút gọn rồi cộng là ra


  • 2
    tung123   commented on June 7, 2024, 9:29 p.m.

    code nè

    from fractions import * a = int(input()) b = int(input()) c = int(input()) num = 0 d = Fraction(a, b) e = Fraction(a, c) f = Fraction(b, c) g = Fraction(b, a) h = Fraction(c, a) k = Fraction(c, b) dd = d.numerator dd2 = d.denominator ee = e.numerator ee2 = e.denominator ff = f.numerator ff2 = f.denominator aa = min(d, e, f, g, h, k) if aa == d or aa == g: num = dd+dd2 elif aa == e or aa == h: num = ee+ee2 elif aa == f or aa == k: num = ff+ff2 print(num)


    • 1
      duy_khanh_2k7   commented on Feb. 20, 2025, 8:46 p.m.

      Cần gì phải dùng fractions.Fraction rườm rà thế kia

      from math import gcd
      a, b, c = [int(input()) for _ in range(3)]
      tu_so = min(a, b, c)
      mau_so = max(a, b, c)
      uoc_chung = gcd(tu_so, mau_so)
      print(tu_so//uoc_chung + mau_so//uoc_chung)
      

  • 2
    Clermono   commented on June 4, 2024, 4:39 p.m. edited

    Hint:

    Dùng module fractions của Python


  • -3
    minhtrunggd2014   commented on June 2, 2024, 9:05 a.m.

    tử và mẫu có cần giống nhau không


  • 4
    KPKTuan   commented on May 21, 2024, 2:29 p.m.

    Tìm min và max của 3 số a,b,c


    • 1
      thienthansanga2k13   commented on July 2, 2024, 8:28 a.m.

      là tìm min max rồi rút gọn, sau đó cộng với nhau hả bạn


    • 0
      doanngocgiahung_2004   commented on May 24, 2024, 8:40 p.m.

      a = int(input()) b = int(input()) c = int(input()) print(min(a,b,c)) print(max(a,b,c))


  • 6
    Bongu   commented on May 6, 2024, 4:18 p.m.

    Ai biết cách làm thì chỉ mình với ạ! Cảm ơn mọi người rất nhiều