Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- vector<pair<int,int>>vec;
- int main()
- {
- int k,i,y,cnt;
- while(~scanf("%d",&k))
- {
- double x;
- cnt = 0;
- for(y=k+1; y<=2*k; y++)
- {
- if((k*y)%(y-k))
- continue;
- x = (k*y)/(y-k);
- if(x<y)
- break;
- if((x*y)/(x+y)==k)
- {
- vec.push_back(make_pair(int(x),y));
- cnt++;
- }
- }
- printf("%d\n",cnt);
- for(auto z : vec)
- {
- printf("1/%d = 1/%d + 1/%d\n",k,z.first,z.second);
- }
- vec.clear();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement