分数拆分

来源:互联网 发布:windows10网络无法连接 编辑:程序博客网 时间:2024/06/11 17:44
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <cstdlib>#include <list>using namespace std;int main(){    double k, x, y;    while(scanf("%lf", &k)!=EOF)    {        for(y = 1; y <= 2*k; y++)        {            x = k*y/(y - k);            if(x>0 && x<2147483647 && k*(x+y) == (x*y))            printf("1/%lg=1/%lg+1/%lg\n", k, x, y);        }        cout << endl;    }    return 0;}

原创粉丝点击