hdu 2117
地址:http://acm.hdu.edu.cn/showproblem.php?pid=2117
题意:找1/n小数点后第m位数字。
mark:wa了一次。。没考虑n = 1的情况。。。
代码:
#include <stdio.h> int main() { int n,m; int i,re; while(~scanf("%d%d", &n, &m)) { if(n == 1) {printf("0\n");continue;} re = 10; for(i = 1; i < m; i++) re = (re%n)*10; printf("%d\n", re/n); } return 0; }