#include <iostream> #include <cstring>#include <cstdio>#include <algorithm>#include <string>#include <string.h>#include <cmath>usingnamespacestd;
constint maxn = 3010;
int v[maxn], result[maxn];
int a, b, cnt;
char s[maxn][maxn], temp[maxn];
int main()
{
while (cin >> a >> b)
{
printf("%d/%d = %d.", a, b, a / b);
memset(v, 0, sizeof(v));
a = a%b;
cnt = 0;
while (!v[a])//判断是否是循环节了
{
result[++cnt] = (a * 10) / b;
v[a] = cnt;
a = (a * 10) % b;
}
for (int i = 1; i <= cnt&&i<51; i++)
{
if (i == v[a])
printf("(");
printf("%d", result[i]);
if (i == 50)
printf("...");
}
printf(")\n %d = number of digits in repeating cycle\n\n", cnt - v[a] + 1);
}
//system("pause");
}