#include <stdio.h> #include <string.h> #include <stdlib.h> const int Max = 1000; int main () { char str_1[Max];// str_2[Max]; memset(str_1, 0, 1000); // memset(str_2, 0, 1000); int n; while (scanf("%s%d", str_1, &n) != EOF) { // printf("%s %d\n", str_1, n); int kong = 0; int count = 0; int s[2*Max] = {0}; int arr_1[Max] = {0}, arr_2[Max] = {0}; int len_1 = strlen(str_1); // int len_2 = strlen(str_2); int i, j, m; for (i = 0,j = 0; i < len_1; i++) //?????,??????? if ( str_1[len_1 - i - 1] == '.') kong = i; //printf("i = %d\n", i); else arr_1[j++] = str_1[len_1 - i - 1] - '0', arr_2[j-1] = arr_1[j-1];//, printf("%d",arr_2[j-1]); // printf("\nkong = %d\n", kong); kong = kong * n; // printf("\nkong = %d\n", kong); // for (int j = 0; j < len_2; j++) // arr_2[j] = str_2[len_2 - j - 1] - '0'; for (m = 1; m < n; m++) { for (i = 0; i < Max; i++) //?? for (j = 0; j < Max; j++) { s[i+j] = s[i+j] + arr_1[i] * arr_2[j]; if (s[i+j] >= 10) { s[i+j+1] += s[i+j] / 10; s[i+j] = s[i+j] % 10; } } //?s[]??????arr_1; for (i = 0; i < Max; i++) arr_1[i] = s[i], s[i] = 0; } //???? if (n == 0) //ÊÇ·ñÊÇ 0´Î·½ printf("1"); else if (atof(str_1) == 0) //ÊÇ·ñ Êý×ÖÊÇ 0 printf("0"); else if (atof(str_1) == (int) atof(str_1)) //ÊÇ·ñÊÇÕûÊý { if (kong == 0) //ÊÇ·ñÓÐСÊýµã { for (i = Max - 1; i >= 0 ; i--) if (arr_1[i] != 0) break; for (; i >= 0; i--) printf("%d", arr_1[i]); } else { for (i = Max - 1; i >= 0 ; i--) { if (i == kong-1) printf("."); if (i < kong-1) printf("0"); if (arr_1[i] != 0) break; } for (j=0; i >= j; i--) { printf("%d", arr_1[i]); if ( kong == i) break; } } } else { for (i = Max - 1; i >= 0 ; i--) { if (i == kong-1) printf("."); if (i < kong-1) printf("0"); if (arr_1[i] != 0) break; } j = 0; while (arr_1[j++] == 0) {;} for (; i >= j-1; i--) { printf("%d", arr_1[i]); if ( kong == i) printf("."); } } memset(str_1, 0, 1000); // memset(str_2, 0, 1000); printf("\n"); } return 0; } /* int main() { float n; int m; char s[7]; while (scanf("%s%d", s, &m) != EOF ) { printf("%s %d\n", s, m); } return 0; } */