题目链接:
题意:定义f(A) = log log log log …. (A个log) n ,g[A,B,C] = f(A)^( f(B) ^ f(C) ),现在给定a, b两数组,数组大小最大为3,请计算当n趋向于无穷时,g[a1,a2…] / g[b1…]的值为无穷大或者是无穷小或者是某一个常数?对应输出 1, -1, 0。
题解:我们分别对G(A),G(B)取两次log,化简出来的公式就是 log(log(f(A))) + log(f(B)) * f(C) ,然后记录他们的log次数,然后先比较G(A)和G(B)的 log(log(f(A)))部分 和log(f(B)) * f(C)部分,将大的放在前面,然后进行比较可得到答案。
#includeusing namespace std;#define ll long long#define ull unsigned long long#define mst(a,b) memset((a),(b),sizeof(a))#define pi acos(-1)#define pii pair const int INF = 0x3f3f3f3f;const double eps = 1e-6;const int MAXN = 2e5 + 10;const int MAXM = 2e6 + 10;const ll mod = 1e9 + 7;int a[5],b[5];pii c[5],d[5];int judge(pii x, pii y) { if(x.first < y.first) return 1; else if(x.first > y.first) return -1; else { if(x.second < y.second) return 1; else if(x.second > y.second) return -1; return 0; }}int check() { int flag = judge(c[1], d[1]); if(flag != 0) return flag; return judge(c[2],d[2]);}int main() {#ifdef local freopen("data.txt", "r", stdin);// freopen("data.txt", "w", stdout);#endif int t; scanf("%d",&t); while(t--) { for(int i = 1; i <= 3; i++) a[i] = b[i] = 2e9; int n,m; scanf("%d%d",&n,&m); for(int i = 1; i <= n; i++) scanf("%d",&a[i]); for(int i = 1; i <= m; i++) scanf("%d",&b[i]); c[1] = make_pair(a[1] + 2, 2e9), c[2] = make_pair(min(a[2] + 1, a[3]), max(a[2] + 1, a[3])); c[2].first = min(c[2].first, (int)2e9), c[2].second = min(c[2].second, (int)2e9); d[1] = make_pair(b[1] + 2, 2e9), d[2] = make_pair(min(b[2] + 1, b[3]), max(b[2] + 1, b[3])); d[2].first = min(d[2].first, (int)2e9), d[2].second = min(d[2].second, (int)2e9); if(c[1].first >= c[2].first) swap(c[1], c[2]); if(d[1].first >= d[2].first) swap(d[1], d[2]); printf("%d\n",check()); } return 0;}