Skip to content

Commit

Permalink
🐛 bug: change 500000 into 50000
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchuo committed Sep 1, 2019
1 parent 35b21da commit 1487841
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions AdvancedLevel_C++/1059. Prime Factors (25) .cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#include <cstdio>
#include <vector>
using namespace std;
vector<int> prime(500000, 1);
vector<int> prime(50000, 1);
int main() {
for(int i = 2; i * i < 500000; i++)
for(int j = 2; j * i < 500000; j++)
for(int i = 2; i * i < 50000; i++)
for(int j = 2; j * i < 50000; j++)
prime[j * i] = 0;
long int a;
scanf("%ld", &a);
printf("%ld=", a);
if(a == 1) printf("1");
bool state = false;
for(int i = 2; a >= 2;i++) {
for(int i = 2; i < 50000 && a >= 2; i++) {
int cnt = 0, flag = 0;
while(prime[i] == 1 && a % i == 0) {
cnt++;
Expand All @@ -23,8 +23,8 @@ int main() {
printf("%d", i);
state = true;
}
if(cnt >= 2)
printf("^%d", cnt);
if(cnt >= 2) printf("^%d", cnt);
}
if (a > 1) printf("%s%ld", state ? "*" : "", a);
return 0;
}
}

0 comments on commit 1487841

Please sign in to comment.