有了第一题的经验,我们可以立即猜出所谓
而事实上这道题也就是把式子模拟一下就可以了:
所以 (为了方便书写,我没用题目中的奇怪字母了)
#include<cmath>
#include<cstdio>
int init(){
char c = getchar();
int x = 0, f = 1;
for (; c < '0' || c > '9'; c = getchar())
if (c == '-') f = -1;
for (; c >= '0' && c <= '9'; c = getchar())
x = (x << 1) + (x << 3) + (c ^ 48);
return x * f;
}
void print(int x){
if (x < 0) x = -x, putchar('-');
if (x > 9) print(x / 10);
putchar(x % 10 + '0');
}
int main(){
int T = init();
while (T--) {
double alpha = (double) init(), beta = (double) init();
int gamma = init();
double theta = 2.7182818284590452;
switch (gamma) {
case 1 : { printf("%.1lf\n", pow(alpha, theta) / beta); break; }
case 2 : { printf("%.2lf\n", pow(alpha, theta) / beta); break; }
case 3 : { printf("%.3lf\n", pow(alpha, theta) / beta); break; }
case 4 : { printf("%.4lf\n", pow(alpha, theta) / beta); break; }
case 5 : { printf("%.5lf\n", pow(alpha, theta) / beta); break; }
}
}
}