[Offer收割]编程练习赛54 register

Ended

Participants:154

Verdict:Accepted
Score:100 / 100
Submitted:2018-04-08 12:56:33

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <bits/stdc++.h>
using namespace std;
long long P, Q;
int a[10];
int main() {
    while (true) {
        scanf("%lld%lld", &P, &Q);
        memset(a, 0, sizeof a);
        for (int i = 0; i < 50; ++i) {
            P *= 10;
            a[P/Q] = 1;
            P %= Q;
            if (!P) break;
        }
        for (int i = 0; i < 10; ++i)
            if (a[i]) printf("%d", i);
        printf("\n");
        break;
    }
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX