結果
| 問題 |
No.751 Frac #2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-11-09 23:29:06 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 1,000 ms |
| コード長 | 382 bytes |
| コンパイル時間 | 799 ms |
| コンパイル使用メモリ | 6,912 KB |
| 実行使用メモリ | 8,060 KB |
| 最終ジャッジ日時 | 2024-11-21 06:49:50 |
| 合計ジャッジ時間 | 3,071 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 36 |
ソースコード
#!/usr/bin/python2 # -*- coding: utf-8 -*- # † from operator import mul from fractions import Fraction as frac n = int(raw_input()) a = map(int, raw_input().split()) m = int(raw_input()) b = map(int, raw_input().split()) nume = [a[0]] + b[1::2] deno = a[1:] + b[0::2] nume = reduce(mul, nume) deno = reduce(mul, deno) res = frac(nume, deno) print res.numerator, res.denominator