結果

問題 No.750 Frac #1
ユーザー はむ吉🐹
提出日時 2018-11-09 21:30:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 37 ms / 1,000 ms
コード長 427 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-11-21 05:38:41
合計ジャッジ時間 2,228 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import fractions


def main():
    n = int(input())
    fs = [tuple(int(c) for c in input().split()) for _ in range(n)]
    x = None
    for a, b in fs:
        if a == 0:
            x = b
    gs = sorted(fractions.Fraction(*f) for f in fs)[::-1]
    for g in gs:
        if g.numerator == 0:
            print(g.numerator, x)
        else:
            print(g.numerator, g.denominator)


if __name__ == '__main__':
    main()
0