循环小数(纯C语言版)
#include <stdio.h>

int main()
{
        int a, b;
        scanf("%d %d", &a, &b);
        if(a%b == 0)
        {
                printf("0 0\n");
                return 0;
        }
        int temp[b], i;
        for(i=0; i<b; i++)
                temp[i] = -1;
        int pos = 0;
        a = a % b;
        temp[a] = pos;
        while(a != 0)
        {
                pos++;
                a = a * 10 % b;
                if(temp[a] != -1)
                {
                        printf("%d %d\n", temp[a], pos-temp[a]);
                        return 0;
                }
                temp[a] = pos;
        }
        printf("%d %d\n", pos, 0);
        return 0;
}