#include<cstdio>
#include<cstring>
const int LENGTH = 701;
char F[10];
int n, base_number[LENGTH], power_number[LENGTH], temp_power_number[LENGTH], bit, length;
void transfer(void)//It's a function to refine input to get the non-demical part and bit of the result and the length of the non-demical result.
{
int i, j;
for (i = 0, j = 0; i < 6; i++)
if ('0' <= F[5 - i] && '9' >= F[5 - i])
{
base_number[j] = F[5 - i] - '0';
j++;
}
for (i = 0; i < 6; i++)
if ('.' == F[5 - i])
{
bit = i * n;
break;
}
length = j;
}
void copy(int b[], int c[])//It's a function to copy all contains from array c to array b.
{
for (int i = 0; i < LENGTH; i++)
b[i] = c[i];
}
void accupower(void)//It's a function to get an accurate result of the power an integer.
{
int i, j, k, Len = length * n;
if (1 == n)
copy(power_number, base_number);
else
{
power_number[0] = 1;
for (k = 0; k < n; k++)
{
for (i = 0; i < length; i++)
for (j = 0; j < Len; j++)
{
temp_power_number[i + j] += base_number[i] * power_number[j];
temp_power_number[i + j + 1] += temp_power_number[i + j] / 10;
temp_power_number[i + j] %= 10;
}
copy(power_number, temp_power_number);
memset(temp_power_number, 0, sizeof(temp_power_number));
}
}
}
void sudoprint(void)//It's a function to print output with the strict standard which bans pre-zeros, post-zeros, and dot of integer, etc.
{
int i, end = 0, flag;
if (0 == power_number[0])
for (i = 0; i < LENGTH; i++)
if (0 != power_number[i])
{
end = i;
break;
}
for (i = LENGTH - 1, flag = 0; i >= bit; i--)
if (0 == flag && 0 != power_number[i])
{
flag = 1;
printf("%d", power_number[i]);
}
else if (flag == 1)
printf("%d", power_number[i]);
if (0 != bit && i >= end)
{
printf(".");
for (; i >= end; i--)
printf("%d", power_number[i]);
}
printf("\n");
}
int main()//It's main function, the main part of the program.
{
while (2 == scanf("%s%d", F, &n))
{
transfer();
accupower();
sudoprint();
memset(power_number, 0, sizeof(power_number));
}
return 0;
}
07-30
07-30