from fractions import Fraction x,y,n=int(input()),int(input()),int(input())
f=Fraction(x,y).limit_denominator(n)
print(str(f.numerator)+"/"+str(f.denominator))
I have submitted the code bt shows runtime error on test 1 can anyone help me please?
# | User | Rating |
---|---|---|
1 | Radewoosh | 3759 |
2 | orzdevinwang | 3697 |
3 | jiangly | 3662 |
4 | Benq | 3644 |
5 | -0.5 | 3545 |
6 | ecnerwala | 3505 |
7 | tourist | 3486 |
8 | inaFSTream | 3478 |
9 | maroonrk | 3454 |
10 | Rebelz | 3415 |
# | User | Contrib. |
---|---|---|
1 | adamant | 173 |
2 | awoo | 166 |
3 | nor | 165 |
4 | SecondThread | 162 |
5 | BledDest | 161 |
5 | maroonrk | 161 |
5 | Um_nik | 161 |
8 | -is-this-fft- | 149 |
9 | Geothermal | 146 |
10 | ko_osaga | 142 |
from fractions import Fraction x,y,n=int(input()),int(input()),int(input())
f=Fraction(x,y).limit_denominator(n)
print(str(f.numerator)+"/"+str(f.denominator))
I have submitted the code bt shows runtime error on test 1 can anyone help me please?
Name |
---|
You're reading the input wrong: it should be something like
Your code expects three lines, one number in each; mine expects a single line with three space-separated numbers.