結果
| 問題 | No.3073 Fraction Median |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-19 10:40:38 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 986 ms / 2,500 ms |
| + 466µs | |
| コード長 | 367 bytes |
| 記録 | |
| コンパイル時間 | 373 ms |
| コンパイル使用メモリ | 96,224 KB |
| 実行使用メモリ | 316,608 KB |
| 最終ジャッジ日時 | 2026-07-19 10:41:01 |
| 合計ジャッジ時間 | 19,129 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
import math
from fractions import Fraction
N = int(input())
A = list(map(int, input().split()))
A.sort()
x = Fraction(0, 1)
for i in range(N - 1):
# Fraction(分子,分母)
sub = Fraction(A[i], A[i + 1])
#print(i, sub)
if sub > x:
x = sub
ans = str(x)
if '/' in ans:
ans1, ans2 = ans.split('/')
print(ans1, ans2)
else:
print(x, 1)