リンク:
https://vjudge.net/problem/HDU-6668
質問の意味:
多項式の次数を負担し、最近では限界の概念を学びました。
今、彼は(xは時間の無限大に近づくと(X)、彼は、F(X)/ gで、疑問2個の多項式F(X)及びgを有する X) 数に収束します。
アイデア:
L'病院の後、上から下にこれまで0と無収束と、同じ値で乗算されているので、最高次の項を考慮し、
コード:
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3+10;
int F[MAXN], G[MAXN];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
for (int i = 1;i <= n;i++)
cin >> F[i];
for (int i = 1;i <= n;i++)
cin >> G[i];
int pos = n;
while (F[pos] == 0 && G[pos] == 0 && pos > 0)
pos--;
if (F[pos] != 0 && G[pos] == 0)
cout << "1/0" << endl;
else if (F[pos] == 0 && G[pos] != 0)
cout << "0/1" << endl;
else
cout << F[pos]/__gcd(F[pos], G[pos]) << "/" << G[pos]/__gcd(F[pos], G[pos]) << endl;
}
return 0;
}