Initial commit.
This commit is contained in:
1 parent
e5b0fea18c
commit
9f35f6c558
94 files changed
+12857
No files matched your search
@@ -0,0 +1,26 @@
|
||||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
|
||||
namespace PerfectNumbers.Core;
|
||||
|
||||
public static class InputParser
|
||||
{
|
||||
public static BigInteger ParseBigInteger(string value)
|
||||
{
|
||||
if (value.Contains('^'))
|
||||
{
|
||||
var parts = value.Split('^');
|
||||
BigInteger b = BigInteger.Parse(parts[0], CultureInfo.InvariantCulture);
|
||||
int e = int.Parse(parts[1], CultureInfo.InvariantCulture);
|
||||
return BigInteger.Pow(b, e);
|
||||
}
|
||||
|
||||
return BigInteger.Parse(value, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
public static decimal ParseDecimal(string value)
|
||||
{
|
||||
return decimal.Parse(value, CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user