codeforce 621D - Rat Kwesh and Cheese
题意:求表达式中最大的值。
long double 128位 有效数字18-19 范围正负1.2*10^4932
注意取对数!
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<set>
#include<map>
#include<vector>
#include<cstring>
#include<stack>
#include<cmath>
#include<queue>
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define ll long long
#define clc(a,b) memset(a,b,sizeof(a))
const int maxn=; const char s[][]=
{
"x^y^z",
"x^z^y",
"(x^y)^z",
"(x^z)^y",
"y^x^z",
"y^z^x",
"(y^x)^z",
"(y^z)^x",
"z^x^y",
"z^y^x",
"(z^x)^y",
"(z^y)^x"
}; int main()
{
long double a[];
long double x,y,z;
cin>>x>>y>>z;
a[]=pow(y,z)*log(x);
a[]=pow(z,y)*log(x);
a[]=a[]=y*z*log(x);
a[]=pow(x,z)*log(y);
a[]=pow(z,x)*log(y);
a[]=a[]=x*z*log(y);
a[]=pow(x,y)*log(z);
a[]=pow(y,x)*log(z);
a[]=a[]=x*y*log(z);
int pos=;
for(int i=; i<=; i++)
{
if(a[i]>a[pos])
pos=i;
}
printf("%s\n",s[pos]);
return ;
}
codeforce 621D - Rat Kwesh and Cheese的更多相关文章
- Codeforces Round #341 (Div. 2) D. Rat Kwesh and Cheese 数学
D. Rat Kwesh and Cheese 题目连接: http://www.codeforces.com/contest/621/problem/D Description Wet Shark ...
- 【17.00%】【codeforces 621D】Rat Kwesh and Cheese
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- Codeforces Round #341 Div.2 D. Rat Kwesh and Cheese
嗯本来想着直接算出来不就行了吗 然后我想到了200^200^200....... 好吧其实也不难取两次log就行了 然后我第一次写出来log就写残了........... log里面的拆分要仔细啊.. ...
- Codeforces Round #341 (Div. 2)
在家都变的懒惰了,好久没写题解了,补补CF 模拟 A - Wet Shark and Odd and Even #include <bits/stdc++.h> typedef long ...
- Codeforces Round #341 (Div. 2) ABCDE
http://www.cnblogs.com/wenruo/p/5176375.html A. Wet Shark and Odd and Even 题意:输入n个数,选择其中任意个数,使和最大且为奇 ...
- Backtracking algorithm: rat in maze
Sept. 10, 2015 Study again the back tracking algorithm using recursive solution, rat in maze, a clas ...
- CF 371B Fox Dividing Cheese[数论]
B. Fox Dividing Cheese time limit per test 1 second memory limit per test 256 megabytes input standa ...
- hdu 1078 FatMouse and Cheese
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission( ...
- Codeforce - Street Lamps
Bahosain is walking in a street of N blocks. Each block is either empty or has one lamp. If there is ...
随机推荐
- oracle LogMiner配置使用
一.安装LogMiner1.@D:\app\product\11.1.0\db_1\RDBMS\ADMIN\dbmslm.sql 2.@D:\app\product\11.1.0\db_1\RDBMS ...
- CDH安装Hadoop
一.安装CDH-manager 1.关闭selinux 修改/etc/selinux/config 文件 将SELINUX=enforcing改为SELINUX=disabled 重启机器即可 2 ...
- MVC-Model数据注解(一)-系统(DataAnnotations)
要使用验证,首先,web.config要开户验证: <appSettings> <add key="ClientValidationEnabled" value= ...
- wordpress mobile templates
http://themeforest.net/category/wordpress/mobile http://themeforest.net/item/monolith-wp-theme-for-b ...
- vue-cli + webpack
vue-cli + webpack 关于vue.js vue.js是一套构建用户界面的 轻型的渐进式前端框架.它的目标是通过尽可能简单的 API 实现响应的数据绑定和组合的视图组件.使用vue可以给你 ...
- 关于appStore评分的相关说明--转自张诚教授
在iOS7以前,评分地址如下 itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?typ ...
- Automotive Security的一些资料和心得(5):Privacy
1. Introduction 1.1 "Customers own their data and we can be no more than the trsted stewards of ...
- 【NOIP 2012 开车旅行】***
题目描述 小 A 和小 B 决定利用假期外出旅行,他们将想去的城市从 1 到 N 编号,且编号较小的 城市在编号较大的城市的西边,已知各个城市的海拔高度互不相同,记城市 i 的海拔高度为 Hi,城市 ...
- android viewpager change adapter ---在使用viewpager设置新的adapter的时候发现页面还是显示旧的adapter中的值
有一个需求是当用户选择navigationview中的某一项时,右边的viewpager需要动态切换不同的adapter 发现直接setAdapter没有任何反应,加载的数据还是旧的数据 折腾了半天只 ...
- Android 自定义seekbar中,thumb被覆盖掉一部分问题
(图一) (图二) (图三) 做一个自定义的seekbar,更改其背景图片: <com.android.Progress android:id="@+id/focus_seek ...