#include <iostream>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cstdio>
#include <vector>
#include <string>
#include <iterator>
#include <cmath>
#include <deque>
using namespace std;
const int N = 200;
const int INF = 0xfffffff;
//typedef long long ll;
typedef long double ld;
#define INFL 0x7fffffffffffffffLL
#define met(a, b) memset(a, b, sizeof(a))
#define rep(c, a, b) for (int c = a; c < b; c++)
#define nre(c, a, b) for (int c = a; c > b; c--)
//h(n ) = h(n-1)*(4*n-2) / (n+1)
int main ()
{
int ans[N], r;
string a;
while (cin >> a >> r)
{
met (ans, 0);
int k = 0, e = 0, xs = 0, x0 = 0;
bool xss = false;
for (int i=0; i<a.length(); i++)
{
if (a[i] != '.')
{
ans[k++] = a[i] - '0';
e = e * 10 + (a[i] - '0');
}
else xss = true;
}
if(!r)
{
if (e == 0) cout << 0 << endl;
else cout << 1 << endl;
continue;
}
bool flag = false;
if (xss)
{
for (int i=a.length()-1; i>=0; i--) //小数位数
{
if (a[i] == '.') break;
if (a[i] != '0') flag = true;
if (flag) xs++;
else x0++;
}
}
reverse (ans, ans + k);
int c = 0;
for (int i=1; i<r; i++)
{
for (int j=0; j<N; j++)
{
int x = ans[j] * e + c;
ans[j] = x % 10;
c = x / 10;
}
}
int aa = 0, bb = N-1;
if (xs) while (ans[aa] == 0) aa++;
else if (x0) while (ans[aa] == 0 && x0) aa++, x0--;
while (ans[bb] == 0) bb--;
int tt = xs * r - bb + aa - 1;
if (tt >= 0 && xs)
{
cout << ".";
while (tt--) cout << 0;
}
for (int i=bb; i>=aa; i--)
{
cout << ans[i];
if (i == aa + xs * r && xs)
cout << ".";
}
if (aa > bb) cout << 0;
cout << endl;
}
return 0;
}
这道题写哭了 写到崩溃