We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 56aba33 commit f067ab8Copy full SHA for f067ab8
PAT/1096/main.cpp
@@ -0,0 +1,35 @@
1
+#include <iostream>
2
+#include <cmath>
3
+using namespace std;
4
+int main() {
5
+ int n;
6
+ cin >> n;
7
+ int maxn = sqrt(n), len = 0, first = 0;
8
+ for (int i = 2; i <= maxn; i++) {
9
+ int j;
10
+ int tmp = 1;
11
+ for (j = i; j <= maxn; j++) {
12
+ tmp *= j;
13
+ if (n % tmp != 0) {
14
+ break;
15
+ }
16
17
+ if (j - i > len) {
18
+ len = j - i;
19
+ first = i;
20
21
22
+ if (first == 0) {
23
+ cout << 1 << endl << n;
24
25
+ else {
26
+ cout << len << endl;
27
+ for (int i = 0; i < len; i++) {
28
+ cout << first + i;
29
+ if (i + 1 != len) {
30
+ cout << "*";
31
32
33
34
+ return 0;
35
+}
0 commit comments