結果
問題 |
No.751 Frac #2
|
ユーザー |
![]() |
提出日時 | 2021-12-14 12:13:29 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 321 bytes |
コンパイル時間 | 248 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-07-23 14:17:55 |
合計ジャッジ時間 | 4,955 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 WA * 27 |
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n_a Main.rb:3: warning: assigned but unused variable - n_b Syntax OK
ソースコード
n_a = gets.to_i A = gets.split.map(&:to_i) n_b = gets.to_i B = gets.split.map(&:to_i) A << 1 B << 1 def dfs(i, r, nums) if i + 1 < nums.size dfs(i + 1, Rational(r, nums[i]), nums) else Rational(r, nums[i]) end end r = Rational(dfs(1, A[0], A), dfs(1, B[0], B)) puts [r.numerator, r.denominator].join(' ')