#include <stdio.h> int main() { double n, m; int s[20], i = 0, j, k, l, t = 0, r, b = 0, p = 0; scanf("%lf%lf", &n, &m); k = n; l = m;//k分子,l分母 while (l != 1) { if ( l% 2 == 0) l = l / 2; else if (l % 5 == 0) l = l / 5; else break; } while (k < l) { k *= 10; t++; } r = k; if (l != 1) { while (i != 20)//计算20位小数 { while (b > 1) { s[i] = 0; b--; i++; } s[i] = r / l; r = r % l; b = 0; while (r < l) {r *= 10; b++;} i++; } while (t > 0) { l *= 10; t--; } printf("%d.",k/l); for (i = 0; i < 20; i++) { printf("%d", s[i+t]); } } else printf("%g\n", n/m); return 0; }