Codeforces Gym101502 H.Eyad and Math-换底公式
2.0 s
256 MB
standard input
standard output
Eyad was given a simple math problem, but since he is very bad at math he asked you to help him.
Given 4 numbers, a, b, c, and d. Your task is to find whether ab is less than cd or not.
It is guaranteed that the two numbers above are never equal for the given input.
The first line contains an integer T (1 ≤ T ≤ 105), where T is the number of test cases.
Then T lines follow, each line contains four integers a, b, c, and d (1 ≤ a, b, c, d ≤ 109).
For each test case, print a single line containing "<" (without quotes), if ab is less than cd. Otherwise, print ">" (without quotes).
2
9 2 5 3
3 4 4 3
<
>
这个题,emnnn,眼瞎,这么大的数,快速幂也跑爆啊。。。中学时代的换底公式,6的飞起。。。
a的b次方假设为x,求对数为logax=b,换成以10为底的,就是lnx为b*lna,同理c的d次方。水题水题。。。
代码:
1 //H. Eyad and Math-对数,换底公式-快速幂会爆啊啊啊啊啊啊
2 #include<iostream>
3 #include<cstring>
4 #include<cstdio>
5 #include<cmath>
6 #include<algorithm>
7 using namespace std;
8 int main(){
9 int t;
10 while(~scanf("%d",&t)){
11 int a,b,c,d;
12 while(t--){
13 scanf("%d%d%d%d",&a,&b,&c,&d);
14 double ans1=b*log10(a);
15 double ans2=d*log10(c);
16 if(ans1<ans2)printf("<\n");
17 else printf(">\n");
18 }
19 }
20 return 0;
21 }
Codeforces Gym101502 H.Eyad and Math-换底公式的更多相关文章
- 2017 JUST Programming Contest 3.0 H. Eyad and Math
H. Eyad and Math time limit per test 2.0 s memory limit per test 256 MB input standard input output ...
- 【机器学习理论】换底公式--以e,2,10为底的对数关系转化
我们在推导机器学习公式时,常常会用到各种各样的对数,但是奇怪的是--我们往往会忽略对数的底数是谁,不管是2,e,10等. 原因在于,lnx,log2x,log10x,之间是存在常数倍关系. 回顾学过的 ...
- Codeforces 1037 H. Security
\(>Codeforces \space 1037\ H. Security<\) 题目大意 : 有一个串 \(S\) ,\(q\) 组询问,每一次给出一个询问串 \(T\) 和一个区间 ...
- Codeforces 916E Jamie and Tree (换根讨论)
题目链接 Jamie and Tree 题意 给定一棵树,现在有下列操作: $1$.把当前的根换成$v$:$2$.找到最小的同时包含$u$和$v$的子树,然后把这棵子树里面的所有点的值加$x$: ...
- Codeforces Gym101502 I.Move Between Numbers-最短路(Dijkstra优先队列版和数组版)
I. Move Between Numbers time limit per test 2.0 s memory limit per test 256 MB input standard inpu ...
- codeforces#1187E. Tree Painting(树换根)
题目链接: http://codeforces.com/contest/1187/problem/E 题意: 给出一颗树,找到一个根节点,使所有节点的子节点数之和最大 数据范围: $2 \le n \ ...
- Codeforces 997D - Cycles in product(换根 dp)
Codeforces 题面传送门 & 洛谷题面传送门 一种换根 dp 的做法. 首先碰到这类题目,我们很明显不能真的把图 \(G\) 建出来,因此我们需要观察一下图 \(G\) 有哪些性质.很 ...
- Codeforces Gym H. Hell on the Markets 贪心
Problem H. Hell on the MarketsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vj ...
- CodeForces 914DBash and a Tough Math Puzzle(线段树的骚操作)
D. Bash and a Tough Math Puzzle time limit per test 2.5 seconds memory limit per test 256 megabytes ...
随机推荐
- C语言中sizeof的用法
今天同学问我sizeof可不可以计算结构体的大小,我竟然忘了C语言还有sizeof这个函数,我是多久没有写程序了啊!!!惭愧,上研究生后写嵌入式方面的程序就特别少了,看来以后还要经常来练练手才行.现在 ...
- ipvsadm启动报错解决方法
Centos7 yum -y install ipvadm 安装后,启动ipvsadm却报错. Redirecting to /bin/systemctl start ipvsadm.service ...
- java中类与对象的概念(2013-05-04-bd 写的日志迁移
1:类是抽象的,概念的,代表一类事物,比如人类.猫类.. 2:对象是具体的,实际的,代表一个具体的事物 3:类是对象的模板,对象是类的一个个体,实例 创建对象的两种方法: 1.先声明在创建 对象声明: ...
- CodeForces - 485D Maximum Value (数学)
题意: n个数,求出这些数中满足 ai >= aj 的 ai % aj 的最大值. 排序去重,然后对于每一个a[i], 如果找到a[i] 的一个倍数 k*a[i] (k > 1)的位置,那 ...
- bash 统计在线时长最长的十个玩/统计一天内一直处于不活跃状态的玩家的百分比
1.某游戏的客户端每隔5分钟会向服务端报告一次玩家的账户积分,如果两次报告的时间间隔不大于5分钟,认为该玩家在这5分钟内在线,假设报告数据的格式如下: IP Dat ...
- BZOJ 4368: [IOI2015]boxes纪念品盒
三种路径,左边出去左边回来,右边出去右边回来,绕一圈 绕一圈的路径最多出现一次 那么绕一圈的路径覆盖的点一定是左边半圈的右边和右边半圈的左边 枚举绕一圈的路径的起始点(一定要枚举,这一步不能贪心),更 ...
- C++智能指针实现
#include <iostream> #include <string> #define unsigned int size_t using namespace std; / ...
- 小米手机安装 charles 证书,提示“没有可安装的证书”
错误环境: 1. Mac 下的 charles 2. 小米手机(MI 6 MUI 9.6 ,Android 8.x) 错误提示: 安装 charles 证书时,提示“没有可安装的证书” 解决方法: 1 ...
- 哪里是Maven的中央存储库?
当你建立了一个Maven工程,Maven会检查你的pom.xml文件,确定要下载的依赖.首先,Maven将从您的本地库Maven查找,如果没有找到,Maven会从中央存储库-http://repo1. ...
- Oracle数据库的日常使用命令
1. 启动和关闭数据库 sqlplus /nolog; SQL >conn / as sysdba;(上面的两条命令相当于sqlplus ‘/as sysdba’) SQL >st ...