結果

問題 No.751 Frac #2
ユーザー nadarenadare
提出日時 2018-11-09 22:42:11
言語 Python3
(3.11.2 + numpy 1.24.2 + scipy 1.10.1)
結果
AC  
実行時間 21 ms / 1,000 ms
コード長 353 bytes
コンパイル時間 301 ms
実行使用メモリ 8,244 KB
最終ジャッジ日時 2022-12-26 20:33:01
合計ジャッジ時間 2,772 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,100 KB
testcase_01 AC 19 ms
8,096 KB
testcase_02 AC 19 ms
8,016 KB
testcase_03 AC 19 ms
8,200 KB
testcase_04 AC 19 ms
8,008 KB
testcase_05 AC 19 ms
8,104 KB
testcase_06 AC 19 ms
8,020 KB
testcase_07 AC 19 ms
8,104 KB
testcase_08 AC 19 ms
8,184 KB
testcase_09 AC 18 ms
8,044 KB
testcase_10 AC 19 ms
8,156 KB
testcase_11 AC 19 ms
8,104 KB
testcase_12 AC 19 ms
8,048 KB
testcase_13 AC 19 ms
8,044 KB
testcase_14 AC 19 ms
8,104 KB
testcase_15 AC 20 ms
8,044 KB
testcase_16 AC 20 ms
8,180 KB
testcase_17 AC 20 ms
8,244 KB
testcase_18 AC 20 ms
8,204 KB
testcase_19 AC 19 ms
8,156 KB
testcase_20 AC 21 ms
8,092 KB
testcase_21 AC 19 ms
8,244 KB
testcase_22 AC 19 ms
8,072 KB
testcase_23 AC 18 ms
8,176 KB
testcase_24 AC 18 ms
8,120 KB
testcase_25 AC 19 ms
8,020 KB
testcase_26 AC 20 ms
8,228 KB
testcase_27 AC 19 ms
8,020 KB
testcase_28 AC 19 ms
8,096 KB
testcase_29 AC 19 ms
8,044 KB
testcase_30 AC 19 ms
8,120 KB
testcase_31 AC 18 ms
8,092 KB
testcase_32 AC 19 ms
8,144 KB
testcase_33 AC 19 ms
8,100 KB
testcase_34 AC 19 ms
8,124 KB
testcase_35 AC 19 ms
8,184 KB
testcase_36 AC 19 ms
8,092 KB
testcase_37 AC 18 ms
8,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
import operator
from functools import reduce
from math import gcd
def inpl(): return list(map(int, input().split()))

n1 = int(input())
A = inpl()
n2 = int(input())
B = inpl()

X = reduce(operator.mul, [A[0]] + B[1::2])
Y = reduce(operator.mul, A[1:] + B[::2])

Z = gcd(X, Y)

if Y < 0:
    X *= -1
    Y *= -1

print(X//Z, Y//Z)
0