結果

問題 No.3073 Fraction Median
ユーザー sasa8uyauya
提出日時 2025-03-22 03:03:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,117 ms / 2,500 ms
コード長 301 bytes
コンパイル時間 2,132 ms
コンパイル使用メモリ 82,236 KB
実行使用メモリ 276,528 KB
最終ジャッジ日時 2025-03-22 03:03:44
合計ジャッジ時間 18,506 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

class Fraction:
  def __init__(self,x,y):
    g=gcd(x,y)
    self.x=x//g
    self.y=y//g
  
  def __lt__(self,other):
    return self.x*other.y<self.y*other.x

n=int(input())
a=sorted(list(map(int,input().split())))
f=max(Fraction(a[i],a[i+1]) for i in range(n-1))
print(f.x,f.y)
0