Codeforces Round #341 Div.2 D. Rat Kwesh and Cheese
嗯本来想着直接算出来不就行了吗 然后我想到了200^200^200.......
好吧其实也不难取两次log就行了 然后我第一次写出来log就写残了...........
log里面的拆分要仔细啊...
果然涉及到log就容易出问题 一组小于等于1的数据直接就跪了= =
不过我猜跪在这组数据的人应该蛮多的....
解决办法的话应该是对这个数据不log处理吧...懒得写了= =
#include <cstdio> #include <cmath> #include <cstring> #include <queue> #include <vector> #include <algorithm> #define INF 0x3f3f3f3f #define mem(str,x) memset(str,(x),sizeof(str)) #define STOP puts("Pause"); using namespace std; typedef long long LL; int main() { double x, y, z; double data[20]; scanf("%lf%lf%lf", &x, &y, &z); data[1] = z * log(y) + log(log(x)); data[2] = y * log(z) + log(log(x)); data[3] = log(y * z * log(x)); data[4] = data[3]; data[5] = z * log(x) + log(log(y)); data[6] = x * log(z) + log(log(y)); data[7] = log(z * x * log(y)); data[8] = data[7]; data[9] = y * log(x) + log(log(z)); data[10] = x * log(y) + log(log(z)); data[11] = log(y * x * log(z)); data[12] = data[11]; int ans = 1; for(int i = 2; i <= 12; i++){ if(data[i] > data[ans]) ans = i; } switch(ans){ case 1:puts("x^y^z");break; case 2:puts("x^z^y");break; case 3:puts("(x^y)^z");break; case 5:puts("y^x^z");break; case 6:puts("y^z^x");break; case 7:puts("(y^x)^z");break; case 9:puts("z^x^y");break; case 10:puts("z^y^x");break; case 11:puts("(z^x)^y");break; } return 0; }