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

Ended

Participants:163

Verdict:Time Limit Exceeded
Score:50 / 100
Submitted:2017-12-10 13:30:25

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
30
31
#include <iostream>
#include <cmath>
using namespace std;
int factor[50];
int getFactor(int x)
{
    factor[0]=1;
    int len=1;
    bool flag;
    while(x>1)
    {
        for(int i=2;i<=x;++i)
        {
            if(x%i==0)
            {
                x=x/i;
                flag=true;
                for(int j=0;j<len;++j)
                {
                    if(i==factor[j])
                    {
                        flag=false;
                        break;
                    }
                }
                if(flag)
                {
                    factor[len]=i;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX