-
Notifications
You must be signed in to change notification settings - Fork 2
/
1027.txt
47 lines (38 loc) · 943 Bytes
/
1027.txt
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
45
46
47
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
long long k;
long long x;
long long y;
long long a;
long long b;
long long say;
while(cin>>k){
say=0;
long long eded = sqrt(k*k);
for(long long i=1; i<=eded; i++){
if((k*k) % i == 0){
a = i;
b = (k*k) / i;
//cout<<a<<" "<<b<<endl;
if( (k+a) * (k+b) / (2*k+a+b) == k){
say++;
}
}
}
cout<<say<<endl;
for(long long i=1; i<=eded; i++){
if((k*k) % i == 0){
a = i;
b = (k*k) / i;
//cout<<a<<" "<<b<<endl;
if( (k+a) * (k+b) / (2*k+a+b) == k){
cout<<"1/"<<k<<" = 1/"<<(k+b)<<" + 1/"<<(k+a)<<endl;
}
}
}
}
return 0;
}