-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1096.cpp
44 lines (42 loc) · 850 Bytes
/
1096.cpp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// 1096.cpp
// 算法
//
// Created by 王怡凡 on 2017/8/26.
// Copyright © 2017年 王怡凡. All rights reserved.
//
#include <stdio.h>
#include<cmath>
using namespace std;
typedef long long ll;
ll n;
int main() {
scanf("%lld",&n);
ll sqr = (ll)sqrt(1.0*n);
ll ansLen = 0,ansI=0;
for(ll i=2;i<=sqr;i++){
ll temp=1;
ll j=i;
while(1){
temp *= j;
if(n%temp!=0) break;
if(j-i+1>ansLen) {
ansI = i;
ansLen = j-i+1;
}
j++;
}
}
if(ansLen == 0) {
printf("1\n%lld",n);
} else {
printf("%lld\n",ansLen);
for(ll i=0;i<ansLen;i++) {
printf("%lld",ansI+i);
if(i<ansLen-1) {
printf("*");
}
}
}
return 0;
}