結果

問題 No.280 歯車の問題(1)
ユーザー paruki
提出日時 2016-03-19 21:41:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 37 ms / 1,000 ms
コード長 275 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-10-01 09:16:08
合計ジャッジ時間 3,808 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

from fractions import Fraction

N = int(input())
Z = [int(s) for s in input().split()]

gr = Fraction(1,1)
theta = [Fraction(1,1)]
for i in range(N-1):
	theta.append(theta[i]*Fraction(Z[i], Z[i+1]))
	gr *= theta[i]/theta[i+1];
print(str(gr.numerator)+'/'+str(gr.denominator))
0