标签:hdu2522
4 2 3 7 168
0.5 0.3 0.142857 0.005952380
#include <stdio.h> #include <string.h> #define maxn 100002 bool vis[maxn]; int main() { int n, i, t, m; scanf("%d", &t); while(t--){ scanf("%d", &n); if(n < 0){ printf("-"); n = -n; } if(n == 1){ printf("1\n"); continue; } memset(vis, 0, sizeof(bool) * n); printf("0."); m = 1; vis[0] = 1; while(!vis[m]){ vis[m] = 1; m *= 10; printf("%d", m / n); m %= n; } printf("\n"); } return 0; }
标签:hdu2522
原文地址:http://blog.csdn.net/chang_mu/article/details/38796869