301042: CF197B. Limit

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Limit

题意翻译

两个函数P(x)与Q(x): P(x)=a$_0$*x$^n$+a$_1$*x$^{n-1}$+……+a$_{n-1}$*x+a$_n$ 和 Q(x)=b$_0$*x$^n$+b$_1$*x$^{n-1}$+……+b$_{n-1}$*x+b$_n$ 当x趋近于无穷大时,P(x)/Q(x)收敛于a,而你要算的,便是这个a

题目描述

You are given two polynomials: - $ P(x)=a_{0}·x^{n}+a_{1}·x^{n-1}+...+a_{n-1}·x+a_{n} $ and - $ Q(x)=b_{0}·x^{m}+b_{1}·x^{m-1}+...+b_{m-1}·x+b_{m} $ . Calculate limit ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF197B/c4175ff9e67dcea784338cdf48751a5246b376e3.png).

输入输出格式

输入格式


The first line contains two space-separated integers $ n $ and $ m $ ( $ 0<=n,m<=100 $ ) — degrees of polynomials $ P(x) $ and $ Q(x) $ correspondingly. The second line contains $ n+1 $ space-separated integers — the factors of polynomial $ P(x) $ : $ a_{0} $ , $ a_{1} $ , ..., $ a_{n-1} $ , $ a_{n} $ $ (-100<=a_{i}<=100,a_{0}≠0) $ . The third line contains $ m+1 $ space-separated integers — the factors of polynomial $ Q(x) $ : $ b_{0} $ , $ b_{1} $ , ..., $ b_{m-1} $ , $ b_{m} $ $ (-100<=b_{i}<=100,b_{0}≠0) $ .

输出格式


If the limit equals $ +∞ $ , print "Infinity" (without quotes). If the limit equals $ -∞ $ , print "-Infinity" (without the quotes). If the value of the limit equals zero, print "0/1" (without the quotes). Otherwise, print an irreducible fraction — the value of limit ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF197B/c4175ff9e67dcea784338cdf48751a5246b376e3.png), in the format "p/q" (without the quotes), where $ p $ is the — numerator, $ q $ $ (q&gt;0) $ is the denominator of the fraction.

输入输出样例

输入样例 #1

2 1
1 1 1
2 5

输出样例 #1

Infinity

输入样例 #2

1 0
-1 3
2

输出样例 #2

-Infinity

输入样例 #3

0 1
1
1 0

输出样例 #3

0/1

输入样例 #4

2 2
2 1 6
4 5 -7

输出样例 #4

1/2

输入样例 #5

1 1
9 0
-5 2

输出样例 #5

-9/5

说明

Let's consider all samples: 1. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF197B/fa0398edff13cf2c92e5c43221f39e276c660081.png) 2. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF197B/c67cf94a1cc8bcaea0f1fad4d1517e71a16c059c.png) 3. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF197B/10f72864aeb3074d34f0800e3222dff4f843160b.png) 4. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF197B/40209670dcba21fdfb878390c6903f068a0dc416.png) 5. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF197B/9292f5d3f957b00c90b246f44689b5ebc7f89abc.png) You can learn more about the definition and properties of limits if you follow the link: http://en.wikipedia.org/wiki/Limit\_of\_a\_function

Input

题意翻译

两个函数P(x)与Q(x): P(x)=a$_0$*x$^n$+a$_1$*x$^{n-1}$+……+a$_{n-1}$*x+a$_n$ 和 Q(x)=b$_0$*x$^n$+b$_1$*x$^{n-1}$+……+b$_{n-1}$*x+b$_n$ 当x趋近于无穷大时,P(x)/Q(x)收敛于a,而你要算的,便是这个a

加入题单

上一题 下一题 算法标签: