【思维】Codeforces Round #485 (Div. 2) B. High School: Become Human(对数)

题目链接:http://codeforces.com/contest/987/problem/B

在运算的时候取对数就好了

 1 #include <bits/stdc++.h>
 2
 3 using namespace std;
 4
 5 #define ll long long
 6 #define eps 1e-6
 7
 8 int main()
 9 {
10     ll x,y;
11     double xx;
12     scanf("%lld %lld",&x,&y);
13     xx = y*log10(x) - x*log10(y);
14     if(fabs(xx-0) <= eps)
15     {
16         printf("=\n");
17     }
18     else
19     {
20         if(xx-0 < eps)
21         {
22             printf("<\n");
23         }
24         else
25         {
26             printf(">\n");
27         }
28     }
29
30     return 0;
31 }

原文地址:https://www.cnblogs.com/duny31030/p/9108981.html

时间: 2024-08-29 09:35:45

【思维】Codeforces Round #485 (Div. 2) B. High School: Become Human(对数)的相关文章

Codeforces Round #485 (Div. 2) E. Petr and Permutations

Codeforces Round #485 (Div. 2) E. Petr and Permutations 题目连接: http://codeforces.com/contest/987/problem/E Description Petr likes to come up with problems about randomly generated data. This time problem is about random permutation. He decided to gene

Codeforces Round #485 (Div. 2) D. Fair

Codeforces Round #485 (Div. 2) D. Fair 题目连接: http://codeforces.com/contest/987/problem/D Description Some company is going to hold a fair in Byteland. There are $n$ towns in Byteland and $m$ two-way roads between towns. Of course, you can reach any t

CodeForces839B[思维] Codeforces Round #428 (Div. 2)

#include <bits/stdc++.h> using namespace std; int n, k; const int MOD = 1000000007; int a[105], cnt[5]; void solve() { int t; cnt[4]=n,cnt[2]=2*n; for(int i=0;i<k;i++){ t=min(a[i]/4,cnt[4]); a[i]-=4*t; cnt[4]-=t; } cnt[2]+=cnt[4]; cnt[1]+=cnt[4];

Codeforces Round #485 (Div. 2)

A. Infinity Gauntlet time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems: the Power G

Codeforces Round #485 (Div. 2) C Three displays

C. Three displays It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem. There are nn displays placed along a road, and the ii-th

Codeforces Round #485 (Div. 2)-B-High School: Become Human

B. High School: Become Human time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Year 2118. Androids are in mass production for decades now, and they do all the work for humans. But androids ha

Codeforces Round #485 Div. 1 vp记

A:对每种商品多源bfs一下每个点到该商品的最近距离,对每个点sort一下取前s个即可. #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<cstring> #include<algorithm> using namespace std; #define ll long long #define int long long #d

Codeforces Round #423 (Div. 2) C 思维,并查集 或 线段树 D 树构造,水

Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals) C. String Reconstruction   思维,并查集 或 线段树 题意:一个字符串被删除了,但给出 n条信息,要还原出可能的字典序最小的字符串.信息有:字符串ti,ki个位置xi,表明原本的字符串在xi位置是以字符串ti开头的. tags:惨遭 fst,一开始把所有字符串都存下来,排序做的,结果爆内存了.. 方法1: 考虑并查集,对于字符串 ti,在位置xi,

贪心/思维题 Codeforces Round #310 (Div. 2) C. Case of Matryoshkas

题目传送门 1 /* 2 题意:套娃娃,可以套一个单独的娃娃,或者把最后面的娃娃取出,最后使得0-1-2-...-(n-1),问最少要几步 3 贪心/思维题:娃娃的状态:取出+套上(2),套上(1), 已套上(0),先从1开始找到已经套好的娃娃层数, 4 其他是2次操作,还要减去k-1个娃娃是只要套上就可以 5 详细解释:http://blog.csdn.net/firstlucker/article/details/46671251 6 */ 7 #include <cstdio> 8 #i