-
Notifications
You must be signed in to change notification settings - Fork 0
/
10976.cpp
51 lines (45 loc) · 1.13 KB
/
10976.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
45
46
47
48
49
50
#include <bits/stdc++.h>
using namespace std;
#define SZ(v) (int)v.size()
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
#define FN(s,c) (int)s.find(c)
#define FOR(i,e) for (int i = 0; i < e; i++)
#define FORR(i,s,e) for (int i = s; i <= e; i++)
#define ROF(i,s) for (int i = s-1; i >= 0; i--)
#define ROFF(i,s,e) for (int i = s; i >= e; i--)
#define IT(v,it) for(it=v.begin();it!=v.end();it++)
#define ITT(v,it) for(it=v.rbegin();it!=v.rend();it++)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define FILL(a,v) memset(a,v,sizeof(a))
typedef long long ll;
/*************************************************/
int main() {
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
#endif
int k;
while (cin >> k) {
vector<pair<int, int> > ans;
FORR(y,k+1,2*k)
{
ll temp1, temp2;
temp1 = k * y;
temp2 = y - k;
ll x = temp1 / temp2;
if ((x * y) / (x + y) == k && k * (x + y) == x * y) {
ans.PB(MP(x, y));
}
}
cout << SZ(ans) << endl;
FOR(i,SZ(ans))
{
printf("1/%d = 1/%d + 1/%d\n", k, ans[i].F, ans[i].S);
}
}
return 0;
}