枚举法
水题
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
const int maxn = 1000 + 5;
int main(){
int k,x,y,cnt;
int xx[maxn],yy[maxn];
bool flag;
while(cin >> k && k!=0){
cnt = 0;
for(int i=k+1;i<=2*k;i++){
flag = false;
y = i;
if(k*y%(y-k)==0) {
x=k*y/(y-k);
flag = true;
}
if(flag){
xx[cnt] = x;yy[cnt] = y;cnt++;
//printf("1/%d = 1/%d + 1/%d\n",k,x,y);
}
}
cout<<cnt<<endl;
for(int i=0;i<cnt;i++){
printf("1/%d = 1/%d + 1/%d\n",k,xx[i],yy[i]);
}
}
return 0;
}