加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

hdu 2117 Just a Numble

发布时间:2020-12-14 03:42:12 所属栏目:大数据 来源:网络整理
导读:hdu ? 2117 ? Just a Numble ? ? ? ? ? ? ? ? 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2117 题目大意:给出两个整数n、m,求1/n所得小数的小数点后第m位数。 题目分析:大数相除模拟水。 code: #includestdio.h#includestring.hint main(){ in

hdu ? 2117 ? Just a Numble ? ? ? ? ? ? ? ? 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2117

题目大意:给出两个整数n、m,求1/n所得小数的小数点后第m位数。

题目分析:大数相除模拟水。

code:

#include<stdio.h>
#include<string.h>
int main()
{
    int i,j,n,m,a[100000];
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        memset(a,sizeof(a));
        i=10,j=1;
        while(j<m)
        {
            if(!i)break;
            while(i<n)i*=10,j++;
            a[j]=i/n;
            i%=n;
            //printf("i==%dnj==%d",i,j);
        }
        printf("%dn",a[m]);
    }
    return 0;
}
PS:一开始被数据范围吓到了,惨……

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读