折叠用自己的方式去月球【难度:1级】:
答案1:
using System;
using System.Collections.Generic;
public class Kata
{
public static int? FoldTo(double distance)
{
double thickness = 0.0001;
if (distance < 0 )
return null;
if (distance >= 0 && distance <= thickness)
return 0;
return (int)Math.Ceiling(Math.Log((distance / thickness), 2));
}
}
答案2:
public class Kata
{
public static int? FoldTo(double distance)
{
if (distance < 0)
return null;
var foldthickness = 0.0001;
var amountOfFolds = 0;
while (foldthickness < distance)