拼多多C题

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <cmath>
#pragma warning(disable:4996)


#define mn 1000010
using namespace std;
int p[mn], q[mn];
int main()
{
    int i, m, n, r, t;

    while (~scanf("%d%d", &m, &n)) {
        m = m % n;
        for (i = 0; i < mn; i++)
        {
            p[i] = -1;
            q[i] = 0;
        }
        t = 0;
        r = m;
        while (r != 0 && (p[r] == -1))
        {
            p[r] = t;
            r = 10 * r;
            t++;
            q[t] = r / n;
            r = r%n;
        }
        //printf("%d\n", r);
        if (m % n == 0)
            printf("0 0\n");
        else if (r != 0)
            printf("%d %d\n", p[r], t - p[r]);
        else {
            printf("%d %d\n", t, 0);
        }
    }
    return 0;
}

#拼多多#
全部评论
ac啦?
点赞 回复 分享
发布于 2018-08-31 00:32
不用容器。。快一些
点赞 回复 分享
发布于 2018-08-30 21:19

相关推荐

05-16 21:54
已编辑
门头沟学院 前端工程师
蓝曦111:我也是25届,这是第二次被裁了,毕业没到一年就失业两次,两次都是公司问题。第一家才转正一个月,跟我说公司拿不到项目结款没办法,赔了一个月;第二个公司连工资都发不出来了,赔偿更别想了,我算是认命了,这条路也不知道能走多远走多久,不过生活还是要继续的,走一步看一步吧
当你面对裁员会如何?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务