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 ...
随机推荐
- 使用phpize安装php模块
1.下载包 2./usr/local/php/bin/phpize 3../configure --enable-soap --with-php-config=/usr/local/php/bin/ ...
- SQL注入原理二
随着B/S模式应用开发的发展,使用这种模式编写应用程序的程序员也越来越多. 但是由于程序员的水平及经验也参差不齐,相当大一部分程序员在编写代码的时候 ,没有对用户输入数据的合法性进行判断,使应用程序存 ...
- NodeJS+ExpressJS+SocketIO+MongoDB应用模板
OS:Win8.1 with update 关键字:NodeJS,ExpressJS,SocketIO,MongoDB. 1.源代码下载:https://github.com/ldlchina/ESM ...
- shell写的计算器
#!/bin/bashif [ $# -ne 3 ] then echo "Usage: $0 num1 + num2" fi case $2 in +) echo $1$2$3= ...
- OpenGL列主元矩阵的运算
大学线性代数课本是用的行主元矩阵,OpenGL使用的是列主元矩阵.有什么差别呢,对于线性代数学得不够扎实的孩纸来说,还挺烦的. 其实明白了就觉得很简单: 从课本的角度来看,平移矩阵是诸如这样的: 平移 ...
- Jetty使用
目标:在Linux以及Windows下面配置应用: 之前使用过smartfox,安装的时候弹出一个浏览器,一路next,印象很深刻.只是记得他是使用Jetty.最近做的项目也是需要进行配置:过往都是使 ...
- CMOS (1)–PMOS与NMOS
1,名称来源 p,n指示的是生成的沟道类型 2,驱动逻辑0与逻辑1 一般用NMOS驱动逻辑0,用PMOS驱动逻辑1.
- Xcode - 必不可少的插件
1. backLight 2. BBUDebuggerTuckAway 3. Cocoapod 4. FuzzyAutoComplete 5. HOStringSense 6. KissImageN ...
- 探索Microsoft.NET目录
所在目录:D:\Windows\Microsoft.NET(d盘为系统盘) 文件目录 |--D:\Windows\Microsoft.NET |------assembly |------GAC_32 ...
- ASP.NET MVC3 Web应用程序中启用GZip压缩示例
http://www.mzwu.com/article.asp?id=3284 自定义一个筛选器,继承于GZipAttribute: using System;using System.IO.Comp ...