$ \ Color {blue} {temporarily seems I only had one question the value of it (fog)} $
Ideas:
(And only this function without the log without the root looks better) based on the knowledge of the derivative, each time derivative of x will fall times of each item
Of course, time will put down each item x 0 th to do not .......
So, we can put f (x) and g (x) maximum term of x to find out, a large number of long-term will be the highest presence of time, which is the corresponding 1/0 or 0/1;
If the number is equal to the number of f (x) and g (x), then, it would seek a two gcd on the line!
code will be placed here QAQ
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define maxn 1200
#define int long long
using namespace std ;
int T , f[maxn] , f_lop ;
int n , g[maxn] , g_lop ;
signed main() {
scanf("%d",&T) ;
while(T --) {
scanf("%d",&n) ;
f_lop = g_lop = n-1 ;
for(int i = 0 ; i < n ; i ++) {
scanf("%d",&f[i]) ;
}
for(int i = 0 ; i < n ; i ++) {
scanf("%d",&g[i]) ;
}
while(!f[f_lop]&&f_lop>0) {
f_lop --;
}
while(!g[g_lop]&&g_lop>0) {
g_lop -- ;
}
if(f_lop > g_lop) {
puts("1/0") ;
}else if(g_lop > f_lop) {
puts("0/1") ;
}else {
int c = __gcd(f[f_lop],g[g_lop]) ;
cout << f[f_lop]/c << "/" << g[g_lop]/c <<endl ;
}
}
return 0 ;
}