http://www.codewars.com/kata/54ff3102c1bad923760001f3/solutions/csharp

判断给定的字符串有多少个a e i o u

using System;
using System.Linq;

public static class Kata
{
    public static int GetVowelCount(string str)
    {
        return str.Count(x => "aeiou".IndexOf(x) != -1);
    }
}

 

public static class Kata
{
    public static int GetVowelCount(string str)
    {
       return str.Where(c => new [] {'a','e','i','o','u'}.Any(v => v == c)).Count();
    }
}

 

 

http://www.codewars.com/kata/5506b230a11c0aeab3000c1f

 

using System;

public class Evaporator { 
  
  public static int evaporator(double content, double evap_per_day, double threshold) {
    return (int)Math.Ceiling(Math.Log(threshold / 100.0) / Math.Log(1.0 - evap_per_day / 100.0));
  }
}

 

相关文章:

  • 2021-12-02
  • 2021-04-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-07
  • 2021-08-29
  • 2021-07-02
猜你喜欢
  • 2022-02-26
  • 2022-12-23
  • 2021-07-16
  • 2021-12-05
  • 2021-09-20
  • 2022-12-23
  • 2022-01-18
相关资源
相似解决方案