[恢]hdu 2117

2011-12-23 08:04:50

地址:http://acm.hdu.edu.cn/showproblem.php?pid=2117

题意:问1/n的小数点后第m位是多少。高精度除法。

代码:

# include <stdio.h>


int gao(int n, int m)
{
int i, dividend=1, quotient, remainder ;
for (i = 0 ; i <= m ; i++)
{
quotient = dividend/n ;
remainder = dividend % n ;
dividend = remainder * 10 ;
}
return quotient ;
}


int main ()
{
int n, m ;
while (~scanf ("%d%d", &n, &m))
printf ("%d\n", gao(n,m)) ;
return 0 ;
}



posted @ 2012-01-06 23:30  Seraph2012  阅读(198)  评论(0编辑  收藏  举报