【题意】给你一个数k,求所有使得1/k = 1/x + 1/y成立的x≥y的整数对。
【解题方法】数论,枚举。枚举所有在区间(k+1,2k)上的y即可,当1/k - 1/y的结果分子为1即为一组解。
【AC代码】
//
//Created by just_sort 2016/1/3
//Copyright (c) 2016 just_sort.All Rights Reserved
//
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/hash_policy.hpp>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdio>
#include <time.h>
#include <cstdlib>
#include <cstring>
#include <sstream> //isstringstream
#include <iostream>
#include <algorithm>
using namespace std;
using namespace __gnu_pbds;
typedef long long LL;
typedef pair<int, LL> pp;
#define REP1(i, a, b) for(int i = a; i < b; i++)
#define REP2(i, a, b) for(int i = a; i <= b; i++)
#define REP3(i, a, b) for(int i = a; i >= b; i--)
#define CLR(a, b) memset(a, b, sizeof(a))
#define MP(x, y) make_pair(x,y)
const int maxn = 100;
const int maxm = 2e5;
const int maxs = 10;
const int INF = 1e9;
const int UNF = -1e9;
const int mod = 1e9+7;
int gcd(int x, int y) {return y == 0 ? x : gcd(y, x % y);}
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>order_set;
//head
int a[10010];
int main()
{
int k;
while(scanf("%d", &k) != EOF)
{
int cnt = 0;
REP2(y, 1, 2 * k){
if(y == k) continue;
if((abs(k * y) % abs(y - k) == 0) && ((k * y) / (y - k) >= y)){
a[++cnt] = y;
}
}
printf("%d\n", cnt);
REP2(i, 1, cnt){
printf("1/%d = 1/%d + 1/%d\n", k, (k * a[i]) / (a[i] - k), a[i]);
}
}
return 0;
}