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

Ended

Participants:154

Verdict:Accepted
Score:100 / 100
Submitted:2018-04-08 14:01:45

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
26
27
28
29
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin >> n >> m;
    set<int> res,yu;
    int temp = n * 10,ty =0;
    while(true)
    {
        int shang = temp/m;
        ty = temp%m;
        if(yu.find(ty) == yu.end() )
            yu.insert(ty);
        else if(res.find(shang) == res.end() )
            {
            }
        else
            break;
        res.insert(shang);
        if(ty == 0)
            break;
        temp = ty * 10;
    }
    for(set<int>::iterator it = res.begin(); it != res.end(); ++it)
        cout<<*it;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX