HW5.14

HW5.14

 public class Solution
 {
     public static void main(String[] args)
     {
         System.out.printf("%s\t%s\n", "i", "m(i)");

         for(int i = 10; i <= 100; i += 10)
             System.out.printf("%d\t%f\n", i, getMi(i * 1.0));
     }

     public static double getMi(double number)
     {
         double sum = 0;
         for(int i = 1; i <= number; i++)
             sum += 4 * (1.0 / (2 * i - 1) - 1.0 / (2 * i + 1));
         return sum;
     }
 }
上一篇:【校招面试 之 C/C++】第9题 C++多态


下一篇:URAL 1085 Meeting(最短路)