Last active
November 7, 2019 15:08
-
-
Save WildGenie/762e83010330c0e53f0623443e18bd7e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Text; | |
/** | |
* Auto-generated code below aims at helping you parse | |
* the standard input according to the problem statement. | |
**/ | |
class Solution | |
{ | |
static void Main(string[] args) | |
{ | |
long n = int.Parse(Console.ReadLine()); | |
// Write an action using Console.WriteLine() | |
// To debug: Console.Error.WriteLine("Debug messages..."); | |
for (long divide = 1; divide <= Math.Sqrt(n * n); divide++) | |
{ | |
if (n * n % divide == 0) | |
{ | |
long y = n + n * n / divide; | |
long x = divide + n; | |
if (x > y) break; | |
if (x > 0 && y > 0) | |
Console.WriteLine($"1/{n} = 1/{y} + 1/{x}"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment